Animated.timing() with useNativeDriver laggy / slow on Android
See original GitHub issue- I have reviewed the documentation
- I have searched existing issues
- I am using the latest React Native version
Environment
Environment:
OS: macOS High Sierra 10.13.3
Node: 8.6.0
Yarn: 1.3.2
npm: 5.7.1
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.52.0 => 0.52.0
Note: Running on Galaxy S8 running Android version 7.x.
Steps to Reproduce
- Create a
new Animated.Value()
- Animated the value using
Animated.Timing()
, withuseNativeDriver = true
- Set the style attribute of a large
Animated.View
to:{[styles, { transform: { translateX: myValue } }]}
- Create a trigger element to trigger the animation
I have created an example project here which exhibits this behavior: https://github.com/jeremyblalock/RNAnimationTest
Expected Behavior
Because we’re using useNativeDriver: true
, I expected the animation performance to be high, comparable to a native animation.
Actual Behavior
- The frame rate on android appears to be around 10-15 fps, much lower than expected
- This is the case even for very simple apps with no HTTP calls / etc.
- For simple apps,
useNativeDriver
actually significantly decreases performance on Android
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:8 (1 by maintainers)
Top Results From Across the Web
React-Native Animated lags behind in low end Android phones
Animations are very processing heavy, so please make sure you use useNativeDriver whenever possible and wherever applicable.
Read more >Performance issues and jumpy animations on Android when ...
When I set useNativeDriver: true to true inside of the Animated.event it becomes really smooth and the problem goes away, but that has...
Read more >How to Achieve 60FPS Animations in React Native - Callstack
Animate at 60FPS no matter what. Issue: JS-driven animations are occupying the bridge traffic and slow down the application. Mobile users are ...
Read more >Using Native Driver for Animated
For normal animations the answer is simple, just add useNativeDriver: true to the animation config when starting it. Before: Animated.timing( ...
Read more >Animation | Jetpack Compose - Android Developers
If you want to have fine control over animation time: Use Animation , such as ... exit = slideOutVertically() + shrinkVertically() + fadeOut()...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That’s fine, we can make an exception for issues that are reproduced using Expo and that are likely to still be present in latest.
@react-native-bot: 0.52.0 is the latest version supported by create-react-native-app, as well as Expo. Hence it is easier to demonstrate the issue at this version. The issue seems to persist in 0.54 though, from my testing.