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.sequence doesn't work with useNativeDriver set to true

See original GitHub issue

Just trying to create a spinner with multiple moving parts using Animated.loop, Animated.sequence, and Animated.timing. Works when useNativeDriver is set to false, but not true.

React Native version:

System:
    OS: Windows 10 10.0.18363
    CPU: (8) x64 Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
    Memory: 13.57 GB / 31.95 GB
  Binaries:
    Node: 12.4.0 - C:\Program Files\nodejs\node.EXE
    npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
  SDKs:
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-25 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom       
  IDEs:
    Android Studio: Version  3.5.0.0 AI-191.8026.42.35.6010548
  npmPackages:
    react: 16.9.0 => 16.9.0
    react-native: 0.61.5 => 0.61.5

Steps To Reproduce

  1. Just run my code below,

Describe what you expected to happen:

Expected the sequence to be looped when it finishes.

Snack, code example, screenshot, or link to a repository:

const rotationChat = new Animated.Value(0);
const rotationLoading = new Animated.Value(0);
function Example() {
  React.useEffect(() => {
    Animated.loop(
      Animated.sequence([
        Animated.timing(rotationChat, {
          toValue: 1,
          duration: 2000,
          useNativeDriver: true,
        }),
        Animated.timing(rotationLoading, {
          toValue: 1,
          duration: 2000,
          useNativeDriver: true,
        }),
      ]),
    ).start();

    
    const interval = setInterval(() => console.log(rotationChat, rotationLoading), 200);
    return () => clearInterval(interval);
  }, [])

  return null
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
stale[bot]commented, Jul 3, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community’s attention? This issue may be closed if no further activity occurs. You may also label this issue as a “Discussion” or add it to the “Backlog” and I will leave it open. Thank you for your contributions.

1reaction
JerakRuscommented, Apr 1, 2020

I confirm that the situation is completely the same. React-Native v0.61.4

Read more comments on GitHub >

github_iconTop Results From Across the Web

Animated: `useNativeDriver` was not specified issue of ...
It gives a warning message: Animated: useNativeDriver was not specified. This is a required option and must be explicitly set to true or...
Read more >
How to Fix Animated: `useNativeDriver` was not specified ...
1- First solution for Animation and Animatable As the warning says, we need to specify the useNativeDriver option explicitly and set it to...
Read more >
Animated - React Native
You can use the native driver by specifying useNativeDriver: true in your animation configuration. See the Animations guide to learn more.
Read more >
Bug with Animated.Loop? : r/reactnative - Reddit
I'm enabling native driver and either not setting the “iterations” ... it appears to work fine on the web with useNativeDriver set to...
Read more >
Animated: `useNativeDriver` was not specified issue of ...
Solution: As the warning says, we need to specify the useNativeDriver option explicitly and set it to true or false . 1- Animation...
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