Skip to content

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

Open
intergalacticspacehighway wants to merge 2 commits into
react:mainfrom
intergalacticspacehighway:android/sync-update-mode
Open

feat(android): add unstable_Immediate UpdateMode for synchronous state updates#57164
intergalacticspacehighway wants to merge 2 commits into
react:mainfrom
intergalacticspacehighway:android/sync-update-mode

Conversation

@intergalacticspacehighway

@intergalacticspacehighway intergalacticspacehighway commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

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.
  • Added unit tests to test the follow up re-entrancy event dispatch.
@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 Jun 11, 2026
@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 Jun 11, 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.

1 participant