Skip to content

Add batched animated prop update path on Android (#56468)#56468

Open
bartlomiejbloniarz wants to merge 2 commits into
mainfrom
export-D101157453
Open

Add batched animated prop update path on Android (#56468)#56468
bartlomiejbloniarz wants to merge 2 commits into
mainfrom
export-D101157453

Conversation

@bartlomiejbloniarz

@bartlomiejbloniarz bartlomiejbloniarz commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Summary:

Implements the Android batched animated prop update path on top of the cross-platform delegate chain introduced in the previous commit. Gated behind the optimizedAnimatedPropUpdates feature flag, so this change has no behavioural impact when the flag is off.

  • BatchedAnimatedPropsMountItem.kt: decodes the int/double buffer protocol and applies updates to views.
  • AnimatedPropBufferEncoder + AnimatedPropCommands: C++ side that encodes AnimatedProps into the buffer protocol.
  • FabricMountingManager::synchronouslyUpdateAnimatedPropsOnUIThread: builds the buffers and JNI-calls into Java.
  • FabricUIManagerBinding: wires the SchedulerDelegate override into FabricMountingManager.
  • FabricUIManager.synchronouslyUpdateViewBatch: Java entry point invoked from JNI that constructs and executes a BatchedAnimatedPropsMountItem.

Changelog:
[Android][Added] - Add a batched animated prop update path that applies all pending C++ animation backend updates via a single mount item (gated by optimizedAnimatedPropUpdates)

Differential Revision: D101157453

@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 Apr 16, 2026
@facebook-github-tools facebook-github-tools Bot added p: Software Mansion Partner: Software Mansion Partner p: Facebook Partner: Facebook labels Apr 16, 2026
@meta-codesync

meta-codesync Bot commented Apr 16, 2026

Copy link
Copy Markdown

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

Summary:
Introduces the cross-platform delegate chain for batched animated property updates without any platform implementation:

- Adds `schedulerShouldSynchronouslyUpdateAnimatedPropsOnUIThread` to `SchedulerDelegate` and forwards from `Scheduler`.
- Adds `uiManagerShouldSynchronouslyUpdateAnimatedPropsOnUIThread` to `UIManagerDelegate` and `synchronouslyUpdateAnimatedPropsOnUIThread` to `UIManager`.
- Adds no-op stubs in iOS (`RCTScheduler.mm`), macOS (`RCTScheduler.mm`), Windows (`FabricUIManagerModule`) and CxxPlatform (`SchedulerDelegateImpl`).

No behavioural impact; Android implementation lands in a follow-up.

Changelog:
[Internal]

Differential Revision: D104672455
@meta-codesync meta-codesync Bot changed the title Add batched animated prop update delegate chain Add batched animated prop update path on Android May 11, 2026
@meta-codesync meta-codesync Bot force-pushed the export-D101157453 branch from 9822880 to a6bf42a Compare May 11, 2026 16:05
Summary:
Pull Request resolved: #56468

Implements the Android batched animated prop update path on top of the cross-platform delegate chain introduced in the previous commit. Gated behind the `optimizedAnimatedPropUpdates` feature flag, so this change has no behavioural impact when the flag is off.

- `BatchedAnimatedPropsMountItem.kt`: decodes the int/double buffer protocol and applies updates to views.
- `AnimatedPropBufferEncoder` + `AnimatedPropCommands`: C++ side that encodes `AnimatedProps` into the buffer protocol.
- `FabricMountingManager::synchronouslyUpdateAnimatedPropsOnUIThread`: builds the buffers and JNI-calls into Java.
- `FabricUIManagerBinding`: wires the `SchedulerDelegate` override into `FabricMountingManager`.
- `FabricUIManager.synchronouslyUpdateViewBatch`: Java entry point invoked from JNI that constructs and executes a `BatchedAnimatedPropsMountItem`.

Changelog:
[Android][Added] - Add a batched animated prop update path that applies all pending C++ animation backend updates via a single mount item (gated by `optimizedAnimatedPropUpdates`)

Differential Revision: D101157453
@meta-codesync meta-codesync Bot changed the title Add batched animated prop update path on Android Add batched animated prop update path on Android (#56468) May 11, 2026
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by Bartlomiej Bloniarz in b7548e8

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 May 11, 2026
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by Bartlomiej Bloniarz in 07137c2

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

}

when (cmd) {
in CMD_OPACITY..CMD_SHADOW_RADIUS ->

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about listing all enum values explicitly instead of using ..? The current version is very prone to breaking when we introduce new props or change the underlying enum values

static constexpr int CMD_BORDER_START_COLOR = 45;
static constexpr int CMD_BORDER_END_COLOR = 46;

// Transform commands

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also want to add support for transformOrigin?

}
}

override fun toString(): String {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like it that this logic is duplicated

CMD_BORDER_RIGHT_COLOR -> ViewProps.BORDER_RIGHT_COLOR
CMD_BORDER_START_COLOR -> ViewProps.BORDER_START_COLOR
CMD_BORDER_END_COLOR -> ViewProps.BORDER_END_COLOR
else -> "unknown"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just fail here

CMD_SKEW_Y -> "skewY"
CMD_MATRIX -> "matrix"
CMD_PERSPECTIVE -> "perspective"
else -> "unknown"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Comment on lines +286 to +289
CMD_SCALE_X -> ViewProps.SCALE_X
CMD_SCALE_Y -> ViewProps.SCALE_Y
CMD_ROTATE -> "rotate"
CMD_ROTATE_X -> "rotateX"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we sometimes use ViewProps.* and sometimes string literal?

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. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook p: Software Mansion Partner: Software Mansion Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants