-
Notifications
You must be signed in to change notification settings - Fork 24.6k
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: Preserve native animated value after animated component unmount #28841
Fix: Preserve native animated value after animated component unmount #28841
Conversation
Hi @TMaszko! Thank you for your pull request and welcome to our community.We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Base commit: ee39945 |
Base commit: ee39945 |
Hey @janicduplessis, we would really appreciate if you could take a look at it |
Hi @TMaszko, this looks reasonable to me at first glance, though I need to do a deeper code-review. Is it possible to create an RNTester example for this, maybe to one of the existing Animation examples? That would make it a lot easier to test and to prevent regressions in the future. |
Hi @JoshuaGross , I added this example to the Animated examples as you have asked for :) |
@JoshuaGross any update/feedback?? |
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.
@JoshuaGross has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
I'll test this internally. |
I have minor concerns about perf implications of this, since it adds a native module/TM call to every animated view detach - and those calls aren't free. However, this seems pretty reasonable overall; and as for perf implications, users should strive to re-render or detach Animated values/Views as little as possible anyway, so it doesn't really change any constraints. Given that caveat I think it's reasonable to merge and it seems like there are no ill effects within the FB app. :) |
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.
@JoshuaGross has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
This pull request was successfully merged by @TMaszko in d922842. When will my fix make it into a release? | Upcoming Releases |
Summary
After animation has been finished using Native driver there is no final value passed from the native to JS side. This causes a bug from #28114.
This PR solves this problem in the same way as
react-native-reanimated
library. When detaching it is calling native side to get the last value from Animated node and stores it on the JS side.Preserving animated value even if animation was using
useNativeDriver: true
Fixes #28114
Changelog
[Internal] [Fixed] - Save native Animated node value on JS side in detach phase
Test Plan
Unit tests for added getValue method passed. Green CI