-
-
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
Simple animations with useAnimatedStyle flicker on Fabric #6865
Comments
I recently reported this issue in react-navigation but I suspect it's closely related to this issue. |
I notice there are all sorts of bugs when used reanimated on the new architecture include this |
This is also true for useDerivedValue |
A similar issue was reported for Android (#6854) and I believe the issues likely have the same root cause (see #6776). The state between Reanimated and React Native seems to get out of sync, causing animations to jump between what Reanimated thinks the value should be and what React Native thinks the value should be. I had thought the issue may be related to a render from the React Native side coinciding with the animation (e.g. prop change). But your simple example does not trigger a render -- the height is only being changed by Reanimated. That would seem to suggest that something else may be happening. I see similar issues in my app when using (Note: react-native-drawer-layout sets |
Thanks for the context @mhoran! And yeah, I've been following both issues you linked, and also thought they were somehow related. I also have the patch from #6776 applied locally to fix Modal behaviors for now. I found this issue when trying to upgrade an app to RN 0.76 with New Arch, and a few other issues related to navigation flickering / screens jumping around, but those I failed to reproduce in a fresh new app unfortunately. Thanks for the tip on |
It seems that with a longer I'm trying to isolate the issue I'm seeing with (animated) props as it seems related, but it's incredibly hard to test outside of a fully integrated app. I'm hoping all these issues will be fixed once the commit hook issue is resolved, but having dedicated repros would make it easier for the Reanimated team. |
@thiagobrez curious if my repo here reproduces the issue for you: /~https://github.com/danieljvdm/screens-bug. For me I can reproduce issues when presenting screens when there's a screen in the stack that has |
The issue here isn't really performance related. You are animating the height using There isn't really anything we can do with that on our side. You can use height.value = withClamp(
{ min: 0 },
withSpring(height.value > 0 ? 0 : 200)
); alternatively, you could use, but this would look less "springy": height.value = withSpring(height.value > 0 ? 0 : 200, {
clamp: { min: 0 },
}); |
@bartlomiejbloniarz should
|
@mhoran Yes, they do different things. Setting duration overrides the |
Description
Simple animations such as animating the
height
of a component withuseAnimatedStyles
andwithSpring
flicker on New Architecture with Fabric.Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-01-03.at.15.50.14.mp4
Steps to reproduce
const height = useSharedValue<number>(0);
const animatedStyles = useAnimatedStyle(() => ({ height: height.value }));
const onToggleHeight = () => { height.value = withSpring(height.value > 0 ? 0 : 200) };
<Animated.View style={animatedStyles} />
height: 0
in this case. I've also seen it happen when animating toopacity: 0
in other casesSnack or a link to a repository
/~https://github.com/thiagobrez/reanimated-repro
Reanimated version
3.16.6
React Native version
0.76.5
Platforms
Android, iOS
JavaScript runtime
Hermes
Workflow
React Native
Architecture
Fabric (New Architecture)
Build type
Debug app & dev bundle
Device
iOS simulator
Device model
No response
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: