Animated.loop doesn't work with vectors and "useNativeDriver" set to "true"
See original GitHub issue🐛 Bug Report
Hello, when I want to loop an animation (Animated.timing
and Animated.loop
) with vectors (Animated.ValueXY
) and with option useNativeDriver
set to true
, the animation is performed only once and the loop doesn’t work.
Work fine without option useNativeDriver
(or set to false
).
This issue concerns only Animated.ValueXY
because the loop works perfectly with single values (Animated.Value
)
It seems to me that it works in an older version of react-native (v0.56.0)
To Reproduce
- Initialize a state value with
new Animated.ValueXY({ x: 0, y: 0 })
- Create an animation with
Animated.timing
- Add a block
Animated.View
with styles and link it with the created animation - Loop the animation with
Animated.loop
Expected Behavior
Animation must loop when I use an Animated.loop
with Animated.ValueXY({ x: 0, y: 0 })
Code Example
https://snack.expo.io/ryF7cRjUV
Environment
React Native Environment Info:
System:
OS: macOS 10.14
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 46.48 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.8.0 - ~/.nvm/versions/node/v10.8.0/bin/node
Yarn: 1.9.4 - ~/.nvm/versions/node/v10.8.0/bin/yarn
npm: 6.2.0 - ~/.nvm/versions/node/v10.8.0/bin/npm
Watchman: 4.7.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 22, 23, 24, 25, 26, 27, 28
Build Tools: 23.0.1, 23.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.2, 28.0.3
System Images: android-22 | Android TV ARM EABI v7a, android-22 | Android TV Intel x86 Atom, android-22 | ARM EABI v7a, android-22 | Intel x86 Atom, android-22 | Intel x86 Atom_64, android-22 | Google APIs ARM EABI v7a, android-22 | Google APIs Intel x86 Atom, android-22 | Google APIs Intel x86 Atom_64, android-23 | Intel x86 Atom, android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom_64, android-25 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-26 | Google Play Intel x86 Atom, android-27 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.0 AI-171.4408382
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.3 => 16.6.3
react-native: 0.58.5 => 0.58.5
npmGlobalPackages:
react-native-cli: 2.0.1
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (1 by maintainers)
Top 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 >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
It's early days for me but already I'm hitting a problem with ... it appears to work fine on the web with useNativeDriver...
Read more >Android – RPLabs – Rightpoint Labs
And only these props can be set with the resulting value. ... There is talk in the GithHub issues about moving all animation...
Read more >Animation Nodes Loop Input performance issue with large 3d ...
I think it is executing the script node every iteration so I added a float list parameter to the loop and put your...
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 FreeTop 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
Top GitHub Comments
Still doesn’t work on the latest version react-native@0.60.4
@dulmandakh iOS & Android
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.