Skip to content

Commit df8632d

Browse files
committed
refactor(chat): migrate Messages shared values to Reanimated 4 .get()/.set()
1 parent 3fef32b commit df8632d

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

components/chat-screen/Messages.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ const Messages = ({
155155
const initialScrollSettlingUntil = useRef(0);
156156
const initialScrollTimers = useRef<ReturnType<typeof setTimeout>[]>([]);
157157
const animatedContainerStyle = useAnimatedStyle(() => ({
158-
opacity: opacity.value,
159-
transform: [{ translateY: revealTranslateY.value }],
158+
opacity: opacity.get(),
159+
transform: [{ translateY: revealTranslateY.get() }],
160160
}));
161161

162162
const clearInitialScrollTimers = useCallback(() => {
@@ -185,8 +185,8 @@ const Messages = ({
185185

186186
schedule(500, () => {
187187
snapToEnd();
188-
opacity.value = withTiming(1, { duration: 350 });
189-
revealTranslateY.value = withTiming(0, { duration: 350 });
188+
opacity.set(withTiming(1, { duration: 350 }));
189+
revealTranslateY.set(withTiming(0, { duration: 350 }));
190190
initialScrollTimers.current = [];
191191
});
192192
}, [clearInitialScrollTimers, opacity, revealTranslateY, snapToEnd]);
@@ -214,9 +214,9 @@ const Messages = ({
214214
hasScrolledToEnd.current
215215
) {
216216
hasScrolledToEnd.current = false;
217-
opacity.value = 0;
217+
opacity.set(0);
218218
pinActive.current = false;
219-
blankSpace.value = 0;
219+
blankSpace.set(0);
220220
}
221221
prevChatLengthRef.current = chatHistory.length;
222222
}, [chatHistory.length, opacity, blankSpace]);

0 commit comments

Comments
 (0)