Skip to content

Step time-based animations only on frames with the shared animated backend (#59565) - #59565

Merged
meta-codesync[bot] merged 1 commit into
react:mainfrom
markv:export-D127496079
Oct 28, 2026
Merged

meta-codesync[bot] merged 1 commit into
react:mainfrom
markv:export-D127496079

Conversation

@markv

@markv markv commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

Fixes native-driven animations stepping backward for a frame when the shared animated backend is on and a native event update (e.g. an Animated.event onScroll) runs between frames. Without the shared backend this does not happen.

With the shared backend, an event update also steps every active timing, spring and decay animation, at the time of the update. Frames step them at the platform frame time (on Android, the Choreographer vsync time), which is often earlier:

  1. An event update steps an animation at time T.
  2. The next frame steps it at T - 8..25 ms.
  3. The animation moves backward for that frame; a timing animation started by the event overshoots past its start value.

Event updates now only propagate the event values, and time-based animations step only on frames. This aligns the shared backend with the implementations it replaces: the Kotlin NativeAnimatedNodesManager updates nodes on events without stepping animations, and the C++ path without the shared backend steps everything on one clock. As on Kotlin, a timing animation whose toValue tracks an event-driven value restarts on each event and advances only on frames between events.

Changelog: [General][Fixed] - Fix native-driven animations stepping backward when a native event update runs between frames with the shared animated backend

Reviewed By: zeyap

Differential Revision: D127496079

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 28, 2026
@meta-codesync

meta-codesync Bot commented Oct 28, 2026

Copy link
Copy Markdown

@markv has exported this pull request. If you are a Meta employee, you can view the originating Diff in D127496079.

markv pushed a commit to markv/react-native that referenced this pull request Oct 28, 2026
…ckend (react#59565)

Summary:
Pull Request resolved: react#59565

Fixes native-driven animations stepping backward for a frame when the shared animated backend is on and a native event update (e.g. an `Animated.event` `onScroll`) runs between frames. Without the shared backend this does not happen.

With the shared backend, an event update also steps every active timing, spring and decay animation, at the time of the update. Frames step them at the platform frame time (on Android, the Choreographer vsync time), which is often earlier:

1. An event update steps an animation at time T.
2. The next frame steps it at T - 8..25 ms.
3. The animation moves backward for that frame; a timing animation started by the event overshoots past its start value.

Event updates now only propagate the event values, and time-based animations step only on frames. This aligns the shared backend with the implementations it replaces: the Kotlin `NativeAnimatedNodesManager` updates nodes on events without stepping animations, and the C++ path without the shared backend steps everything on one clock. As on Kotlin, a timing animation whose `toValue` tracks an event-driven value restarts on each event and advances only on frames between events.

Changelog: [General][Fixed] - Fix native-driven animations stepping backward when a native event update runs between frames with the shared animated backend

Reviewed By: zeyap

Differential Revision: D127496079
@markv
markv force-pushed the export-D127496079 branch from 177c051 to 33704e8 Compare October 28, 2026 04:19
@meta-codesync meta-codesync Bot changed the title Step time-based animations only on frames with the shared animated backend Step time-based animations only on frames with the shared animated backend (#59565) Oct 28, 2026
…ckend (react#59565)

Summary:

Fixes native-driven animations stepping backward for a frame when the shared animated backend is on and a native event update (e.g. an `Animated.event` `onScroll`) runs between frames. Without the shared backend this does not happen.

With the shared backend, an event update also steps every active timing, spring and decay animation, at the time of the update. Frames step them at the platform frame time (on Android, the Choreographer vsync time), which is often earlier:

1. An event update steps an animation at time T.
2. The next frame steps it at T - 8..25 ms.
3. The animation moves backward for that frame; a timing animation started by the event overshoots past its start value.

Event updates now only propagate the event values, and time-based animations step only on frames. This aligns the shared backend with the implementations it replaces: the Kotlin `NativeAnimatedNodesManager` updates nodes on events without stepping animations, and the C++ path without the shared backend steps everything on one clock. As on Kotlin, a timing animation whose `toValue` tracks an event-driven value restarts on each event and advances only on frames between events.

Changelog: [General][Fixed] - Fix native-driven animations stepping backward when a native event update runs between frames with the shared animated backend

Reviewed By: zeyap

Differential Revision: D127496079
@markv
markv force-pushed the export-D127496079 branch from 33704e8 to cf84371 Compare October 28, 2026 18:34
@meta-codesync
meta-codesync Bot merged commit dee5bb5 into react:main Oct 28, 2026
34 of 35 checks passed
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @markv in dee5bb5

When will my fix make it into a release? | How to file a pick request?

@react-native-bot react-native-bot added the Merged This PR has been merged. label Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants