diff --git a/native/chat/utils.js b/native/chat/utils.js --- a/native/chat/utils.js +++ b/native/chat/utils.js @@ -2,7 +2,11 @@ import invariant from 'invariant'; import * as React from 'react'; -import Animated, { type SharedValue } from 'react-native-reanimated'; +import Animated, { + type SharedValue, + interpolate, + useAnimatedStyle, +} from 'react-native-reanimated'; import { useLoggedInUserInfo } from 'lib/hooks/account-hooks.js'; import { useThreadChatMentionCandidates } from 'lib/hooks/chat-mention-hooks.js'; @@ -188,6 +192,7 @@ initialCoordinates, messageListVerticalBounds, progress, + progressV2, targetInputBarHeight, }: AnimatedMessageArgs): { +style: AnimatedViewStyle, @@ -247,16 +252,6 @@ return () => setCurrentTransitionSidebarSourceID(null); }, [setCurrentTransitionSidebarSourceID]); - const bottom = React.useMemo( - () => - interpolateNode(progress, { - inputRange: [0.3, 1], - outputRange: [targetPosition, 0], - extrapolate: Extrapolate.CLAMP, - }), - [progress, targetPosition], - ); - const [isThreadColorDarkOverride, setThreadColorDarkOverride] = React.useState(null); const setThreadColorBrightness = React.useCallback(() => { @@ -293,7 +288,13 @@ targetColor, ]); - const messageContainerStyle = React.useMemo(() => { + const messageContainerStyle = useAnimatedStyle(() => { + const bottom = interpolate( + progressV2.value, + [0.3, 1], + [targetPosition, 0], + Extrapolate.CLAMP, + ); return { bottom: currentTransitionSidebarSourceID ? bottom : 0, opacity: @@ -302,7 +303,7 @@ ? 0 : 1, }; - }, [bottom, currentTransitionSidebarSourceID, sidebarAnimationType]); + }, [currentTransitionSidebarSourceID, sidebarAnimationType]); return { style: messageContainerStyle,