Skip to content

Commit

Permalink
fix: moved animation call into the stop callback to prevent race cond…
Browse files Browse the repository at this point in the history
…ition
  • Loading branch information
Vali-98 committed Apr 27, 2024
1 parent a41f640 commit 985cff5
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions components/ChatMenu/ChatWindow/ChatItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,14 @@ const ChatItem: React.FC<ChatItemProps> = ({
const height = useRef(0)

const handleAnimateHeight = (newheight: number) => {
animatedHeight.stopAnimation()
Animated.timing(animatedHeight, {
toValue: newheight,
duration: 200,
useNativeDriver: false,
easing: Easing.inOut((x) => x * x),
}).start()
animatedHeight.stopAnimation(() =>
Animated.timing(animatedHeight, {
toValue: newheight,
duration: 200,
useNativeDriver: false,
easing: Easing.inOut((x) => x * x),
}).start()
)
}

const handleContentSizeChange = (event: LayoutChangeEvent) => {
Expand Down

0 comments on commit 985cff5

Please sign in to comment.