question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Animated.timing() with useNativeDriver laggy / slow on Android

See original GitHub issue

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(), with useNativeDriver = 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:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
hramoscommented, Mar 21, 2018

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.

1reaction
jeremyblalockcommented, Mar 21, 2018

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found