-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Run all animations on the same thread to prevent out of sync updates #6277
Conversation
@@ -1,19 +1,131 @@ | |||
import { Text, StyleSheet, View } from 'react-native'; | |||
import type { LayoutChangeEvent, StyleProp, ViewStyle } from 'react-native'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will revert changes in this example file when we decide to merge this PR
Hi! I've faced crash issues using this patch and react-native-svg.
Do you have any idea? |
Since we will drop paper support soon and this PR introduced some other new problems, I decided to close it. |
Summary
This PR changes the logic we use to execute animations. It executes all animations on the native thread instead of the UI and native thread to prevent animation synchronization issues. If at least one layout prop animation is detected in the batch, the whole animations batch is executed on the native thread.
It fixes the issue that can be seen only on paper. Fabric works fine as it uses its own logic.
Example recordings
Screen_Recording_20240717_185812_ReanimatedExample.mp4
Screen_Recording_20240717_185915_ReanimatedExample.mp4
Test plan
Remarks
Performance impact must be assessed before merging this PR. It moves the execution of all updated to a single thread, which may not be that efficient compared to running updates on 2 threads (native and UI).