diff --git a/src/lib/custom-animations/CountWheel.tsx b/src/lib/custom-animations/CountWheel.tsx index e2c206078c..17b46a7d18 100644 --- a/src/lib/custom-animations/CountWheel.tsx +++ b/src/lib/custom-animations/CountWheel.tsx @@ -8,10 +8,9 @@ import Animated, { } from 'react-native-reanimated' import {decideShouldRoll} from '#/lib/custom-animations/util' -import {s} from '#/lib/styles' -import {Text} from '#/view/com/util/text/Text' import {atoms as a, useTheme} from '#/alf' import {useFormatPostStatCount} from '#/components/PostControls/util' +import {Text} from '#/components/Typography' const animationConfig = { duration: 400, @@ -147,7 +146,7 @@ export function CountWheel({ big ? a.text_md : a.text_sm, a.user_select_none, isLiked - ? [a.font_semi_bold, s.likeColor] + ? [a.font_semi_bold, {color: t.palette.pink}] : {color: t.palette.contrast_500}, ]}> {formattedCount} @@ -165,7 +164,7 @@ export function CountWheel({ big ? a.text_md : a.text_sm, a.user_select_none, isLiked - ? [a.font_semi_bold, s.likeColor] + ? [a.font_semi_bold, {color: t.palette.pink}] : {color: t.palette.contrast_500}, ]}> {formattedPrevCount} diff --git a/src/lib/custom-animations/CountWheel.web.tsx b/src/lib/custom-animations/CountWheel.web.tsx index c5ca71e9bd..4e160e9a8c 100644 --- a/src/lib/custom-animations/CountWheel.web.tsx +++ b/src/lib/custom-animations/CountWheel.web.tsx @@ -3,10 +3,9 @@ import {View} from 'react-native' import {useReducedMotion} from 'react-native-reanimated' import {decideShouldRoll} from '#/lib/custom-animations/util' -import {s} from '#/lib/styles' -import {Text} from '#/view/com/util/text/Text' import {atoms as a, useTheme} from '#/alf' import {useFormatPostStatCount} from '#/components/PostControls/util' +import {Text} from '#/components/Typography' const animationConfig = { duration: 400, @@ -49,8 +48,8 @@ export function CountWheel({ const shouldAnimate = !useReducedMotion() && hasBeenToggled const shouldRoll = decideShouldRoll(isLiked, likeCount) - const countView = useRef(null) - const prevCountView = useRef(null) + const countView = useRef(null) + const prevCountView = useRef(null) const [prevCount, setPrevCount] = useState(likeCount) const prevIsLiked = useRef(isLiked) @@ -59,17 +58,20 @@ export function CountWheel({ const formattedPrevCount = formatPostStatCount(prevCount) useEffect(() => { + const countViewRef = countView.current as HTMLDivElement | null + const prevCountViewRef = prevCountView.current as HTMLDivElement | null + if (isLiked === prevIsLiked.current) { return } const newPrevCount = isLiked ? likeCount - 1 : likeCount + 1 if (shouldAnimate && shouldRoll) { - countView.current?.animate?.( + countViewRef?.animate?.( isLiked ? enteringUpKeyframe : enteringDownKeyframe, animationConfig, ) - prevCountView.current?.animate?.( + prevCountViewRef?.animate?.( isLiked ? exitingUpKeyframe : exitingDownKeyframe, animationConfig, ) @@ -84,16 +86,14 @@ export function CountWheel({ return ( - + {formattedCount} @@ -103,14 +103,13 @@ export function CountWheel({ {formattedPrevCount} diff --git a/src/lib/custom-animations/LikeIcon.tsx b/src/lib/custom-animations/LikeIcon.tsx index 025e96f4be..da049b72f8 100644 --- a/src/lib/custom-animations/LikeIcon.tsx +++ b/src/lib/custom-animations/LikeIcon.tsx @@ -5,7 +5,6 @@ import Animated, { useReducedMotion, } from 'react-native-reanimated' -import {s} from '#/lib/styles' import {useTheme} from '#/alf' import { Heart2_Filled_Stroke2_Corner0_Rounded as HeartIconFilled, @@ -86,7 +85,7 @@ export function AnimatedLikeIcon({ {isLiked ? ( - + ) : ( - + ) : (