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.

Re-renders affects the behavior of the animations (2.0.0-alpha.6)

See original GitHub issue

Description

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:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
gaishimocommented, Sep 11, 2020

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.

1reaction
jakub-gonetcommented, Sep 11, 2020

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.

Read more comments on GitHub >

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

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