Re-renders affects the behavior of the animations (2.0.0-alpha.6)
See original GitHub issueDescription
If you run setInterval
at the same time as the animation, the animation does not work properly.
In my app, I used setInterval for counting up seconds at the same time as the movement animation. It worked with reanimated 2.0.0-alpha.5 properly. But with 2.0.0-alpha.6, it doesn’t work well.
Screenshots
no setInterval | with setInterval |
---|---|
Steps To Reproduce
Call setInterval(() => {}, 1000)
at the same time as the movement animation
Expected behavior
Animations should work well.
Actual behavior
Animations doesn’t work properly
Snack or minimal code example
https://github.com/gaishimo/reanimated-2-playground-1/blob/set-interval-problem/src/App.tsx
If my use of setInterval is not good, I would be happy to get some advice.
Package versions
- React: 16.13.1
- React Native: 0.63.1
- React Native Reanimated: 2.0.0-alpha.6
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Version History - ReactXP
A new version of ReactXP will be released periodically following the same general update timeline of React Native. Each new version will get...
Read more >material-ui/core/CHANGELOG.md - UNPKG
`event.preventDefault()` is meant to stop default behaviors like clicking a checkbox to check it, hitting a button to submit a form, and hitting...
Read more >@storybook/client-logger | Yarn - Package Manager
Storybook Logger. Any client-side logging that is done through storybook should be done through this package. Examples:
Read more >Release notes - Wt
Release 3.3.6 (July 13, 2016). This release has a focus on bug fixes and some new features: Support for WebSocket compression in wthttp:...
Read more >How to trigger a CSS animation on EVERY TIME a react ...
However, the animation only plays once, on the initial render. I want to play it every time <Card /> re-renders due to cardText...
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
I understand the current useSharedValue behavior. Thanks.
If a situation in which I want to disable this behavior comes up with, I’ll let you know.
From my POV I think it’s better for DX when we prioritize intuitive behavior over performance. Your both solutions sound great, I’m personally more fond of deps one but both are good.
Resolved, so closing.