-
-
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
Make animated component's event tag properly update #6030
Conversation
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.
Nice work, you got the idea, but now we need some polishing to ensure proper maintainability in the future.
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.
We're almost there!
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.
😎
packages/react-native-reanimated/src/createAnimatedComponent/NativeEventsManager.ts
Outdated
Show resolved
Hide resolved
packages/react-native-reanimated/src/createAnimatedComponent/NativeEventsManager.ts
Outdated
Show resolved
Hide resolved
packages/react-native-reanimated/src/createAnimatedComponent/NativeEventsManager.ts
Outdated
Show resolved
Hide resolved
packages/react-native-reanimated/src/createAnimatedComponent/NativeEventsManager.ts
Outdated
Show resolved
Hide resolved
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.
Just check one more thing for me and we gucci. Just make sure to test it thoroughly!
packages/react-native-reanimated/src/createAnimatedComponent/NativeEventsManager.ts
Outdated
Show resolved
Hide resolved
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.
Well done 🫡
Summary
Turns out (thanks to @j-piasecki for noticing) that animated component's event-emitting viewTag can change through re-rendering. The following fix takes care of that.
Test plan
You can go through all
ComposedEventHandler
examples form Example app, as well as code snippets in #5845 (comment).Also, this should work perfectly regardless of re-renders:
Code