Include offset as separate field in payloads (#50970)

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

__onAnimatedValueUpdateReceived is called from 2 places.

It is called from the onAnimatedValueUpdate subscription where the source of the values comes from here: https://fburl.com/8v2cwd2x with getValue() returning the offset + value components combined.

It's also called from in the animation end callback here: https://fburl.com/h36xy2nw where the source of this value comes from https://fburl.com/sud7m7st. In this case it's accessing `nodeValue` directly rather than calling getValue() and so it only includes the value component.

In this diff we pass both the value and offset in both onAnimatedValueUpdate callbacks as well as endCallback.

This allows us to separate the value from the offset on the JS side and ensures we have the latest offset value from native

Changelog: [Android][Fixed] - Sync offset and value from native -> js in separate fields

Reviewed By: zeyap

Differential Revision: D73795619

fbshipit-source-id: e8ed234497e3fcaf9d2a137aa1e17ca8d0f76d97
This commit is contained in:
Martin Booth authored and Facebook GitHub Bot committed 2025-04-29 17:03:44 -07:00
1 parent 1c5ec4bd35
commit 2efe8094c0
13 files changed
+72 -22

No files matched your search

@@ -444,7 +444,7 @@ public abstract class com/facebook/react/animated/AnimatedNode {
}
public abstract interface class com/facebook/react/animated/AnimatedNodeValueListener {
public abstract fun onValueUpdate (D)V
public abstract fun onValueUpdate (DD)V
}
public final class com/facebook/react/animated/NativeAnimatedModule : com/facebook/fbreact/specs/NativeAnimatedModuleSpec, com/facebook/react/bridge/LifecycleEventListener, com/facebook/react/bridge/UIManagerListener {