SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 0 C++

Fix AnimationDriverTests and align with android on rounding (#51922)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51922

changelog: [internal]

fix existing C++ Animated tests and align with Android on how to go from current time to applied frame.

On iOS [floor](https://fburl.com/code/7zy5e5ul) is used to decide which frame to apply. On Android, [round](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/FrameBasedAnimationDriver.kt#L65) is used.

In D75813200 I chose to use `std::ceil` as I wanted to have a predictable behaviour in tests. This is not wrong but it is better to align at least with one of the existing implementations. Let's go with Android as it strikes the balance of what we want to see in tests (an animation that is running for 1000ms should finish after 1000ms, not 1000ms + one frame) and C++ Animated is closer to at least one of the existing implementations.

Reviewed By: christophpurrer

Differential Revision: D76337384

fbshipit-source-id: 444c94d88c2fa60bb4f0649f57e0e42f5cd27626
S
Samuel Susla committed
2079cb295f2ea6267f4a0ce4876b6ea696ce98da
Parent: 79354eb
Committed by Facebook GitHub Bot <[email protected]> on 6/10/2025, 3:03:44 PM