-
-
Notifications
You must be signed in to change notification settings - Fork 537
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(Fabric): not working animations on second-top screen #2270
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.
I don't think we have better option right now. We must do some research on why exactly this is different between Fabric & Paper and most likely try to patch this in core.
const freezePreviousScreen = isFabric() | ||
? size - index > 2 | ||
: size - index > 1; |
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 need to keep in mind that this is only a heuristics anyway and animations won't work on third-top screen etc.
For now we can proceed.
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 can only see this as a problem when we have multiple transparent modals, in which case I wouldn't enable freeze on that navigator anyway.
function isFabric() { | ||
return 'nativeFabricUIManager' in global; | ||
} |
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.
IIRC this should be reliably available during the very first render, so we're safe on that front (the value won't differ on first & consecutive renders).
…nsion#2270) PR fixing animations on Fabric. The problem started in RN 0.74, from which suspending the component triggers its useLayoutEffect. It has the consequences in Animated since detaching the native node happens then: facebook/react-native@a5b84b9/packages/react-native/Libraries/Animated/useAnimatedProps.js#L221-L238.
Description
PR fixing animations on Fabric.
The problem started in RN
0.74
, from which suspending the component triggers itsuseLayoutEffect
. It has the consequences inAnimated
since detaching the native node happens then: https://github.com/facebook/react-native/blob/a5b84b925891fa509bec2e5ee5988bcb0326e198/packages/react-native/Libraries/Animated/useAnimatedProps.js#L221-L238.Changes
Test code and steps to reproduce
Check
Test887.tsx
to see that on fabric, when going forward or back, without this change the screen below is not animating.