Skip to content

feat(android): add unstable_Immediate UpdateMode for synchronous state updates #56311

Open
intergalacticspacehighway wants to merge 1 commit intofacebook:mainfrom
intergalacticspacehighway:android/sync-update-mode
Open

feat(android): add unstable_Immediate UpdateMode for synchronous state updates #56311
intergalacticspacehighway wants to merge 1 commit intofacebook:mainfrom
intergalacticspacehighway:android/sync-update-mode

Conversation

@intergalacticspacehighway
Copy link
Copy Markdown
Contributor

@intergalacticspacehighway intergalacticspacehighway commented Apr 2, 2026

Summary:

Currently we support unstable_Immediate mode on updateState for iOS. This allows us to dispatch synchronous shadow node size updates in Expo UI SwiftUI (communicating SwiftUI children size to Yoga. Host for more details).

Since it is not enabled on android, it leads to layout shift when mixing Compose and React Native components as Compose tree currently dispatches size information asynchronously to the shadow node.

Here, the video demonstrates the asynchronous vs synchronous updateState usage (before and after applying the changes in this PR). Repro link

Screen.Recording.2026-04-02.at.8.52.27.PM.mov

More:

After enabling the update_immediate, I noticed the flicker was still happening. The issue is that update layout instruction triggers a follow up instruction when we set the shadow node size from Expo UI which gets skipped to the next frame. This is handled on iOS using _followUpTransactionRequired flag here. This seems to be added on iOS for similar reasons here when dispatching an instruction can lead to a follow-up instruction when synchronous update is triggered. So we also handle the sync follow up transaction in this PR using similar approach to iOS's.

Changelog:

[ANDROID] [ADDED] - Add unstable_Immediate UpdateMode support in updateState.

Test Plan:

Tested the changes in the repro. Also tested RN Tester, it should be a non breaking change.

@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 2, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

Warning

JavaScript API change detected

This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API.

  • Please include a clear changelog message.
  • This change will be subject to additional review.

This change was flagged as: POTENTIALLY_BREAKING

@facebook-github-tools facebook-github-tools bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Apr 2, 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. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant