Skip to content

Commit

Permalink
More tweaks to animation (#5082)
Browse files Browse the repository at this point in the history
  • Loading branch information
haileyok authored Sep 2, 2024
1 parent 05ac76f commit 4abcd65
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/lib/custom-animations/CountWheel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ export function CountWheel({
{formattedCount}
</Text>
</Animated.View>
{shouldAnimate ? (
{shouldAnimate && (likeCount > 1 || !isLiked) ? (
<Animated.View
entering={exitingAnimation}
// Add 2 to the key so there are never duplicates
key={key + 2}
style={[a.absolute, {width: 50}]}
style={[a.absolute, {width: 50, opacity: 0}]}
aria-disabled={true}>
<Text
style={[
Expand Down
5 changes: 2 additions & 3 deletions src/lib/custom-animations/CountWheel.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export function CountWheel({
return (
<View>
<View
aria-disabled={true}
// @ts-expect-error is div
ref={countView}>
<Text
Expand All @@ -98,9 +97,9 @@ export function CountWheel({
{formattedCount}
</Text>
</View>
{shouldAnimate ? (
{shouldAnimate && (likeCount > 1 || !isLiked) ? (
<View
style={{position: 'absolute'}}
style={{position: 'absolute', opacity: 0}}
aria-disabled={true}
// @ts-expect-error is div
ref={prevCountView}>
Expand Down
48 changes: 22 additions & 26 deletions src/lib/custom-animations/LikeIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,37 +99,33 @@ export function AnimatedLikeIcon({
entering={
shouldAnimate ? circle1Keyframe.duration(300) : undefined
}
style={[
{
position: 'absolute',
backgroundColor: s.likeColor.color,
top: 0,
left: 0,
width: size,
height: size,
zIndex: -1,
pointerEvents: 'none',
borderRadius: size / 2,
},
]}
style={{
position: 'absolute',
backgroundColor: s.likeColor.color,
top: 0,
left: 0,
width: size,
height: size,
zIndex: -1,
pointerEvents: 'none',
borderRadius: size / 2,
}}
/>
<Animated.View
entering={
shouldAnimate ? circle2Keyframe.duration(300) : undefined
}
style={[
{
position: 'absolute',
backgroundColor: t.atoms.bg.backgroundColor,
top: 0,
left: 0,
width: size,
height: size,
zIndex: -1,
pointerEvents: 'none',
borderRadius: size / 2,
},
]}
style={{
position: 'absolute',
backgroundColor: t.atoms.bg.backgroundColor,
top: 0,
left: 0,
width: size,
height: size,
zIndex: -1,
pointerEvents: 'none',
borderRadius: size / 2,
}}
/>
</>
) : null}
Expand Down
2 changes: 2 additions & 0 deletions src/lib/custom-animations/LikeIcon.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export function AnimatedLikeIcon({
zIndex: -1,
pointerEvents: 'none',
borderRadius: size / 2,
opacity: 0,
}}
/>
<View
Expand All @@ -108,6 +109,7 @@ export function AnimatedLikeIcon({
zIndex: -1,
pointerEvents: 'none',
borderRadius: size / 2,
opacity: 0,
}}
/>
</View>
Expand Down

0 comments on commit 4abcd65

Please sign in to comment.