Skip to content

Queue activity results before React context is ready#57051

Open
sorinc03 wants to merge 1 commit into
facebook:mainfrom
sorinc03:fix/android-activity-result-before-react-ready
Open

Queue activity results before React context is ready#57051
sorinc03 wants to merge 1 commit into
facebook:mainfrom
sorinc03:fix/android-activity-result-before-react-ready

Conversation

@sorinc03
Copy link
Copy Markdown
Contributor

@sorinc03 sorinc03 commented Jun 2, 2026

Summary

Fixes #52114.

When ReactHostImpl.onActivityResult is invoked before the bridgeless React context is ready, the result is currently soft-exceptioned and dropped. This can lose results from external activities if the host activity is recreated before React has finished starting.

This change queues activity results while the React context is unavailable, replays them once the context is created, and clears queued results when the host is destroyed.

Changelog:

[ANDROID] [FIXED] - Queue activity results received before bridgeless React context initialization

Test plan

./gradlew :packages:react-native:ReactAndroid:testDebugUnitTest --tests com.facebook.react.runtime.ReactHostTest -Preact.internal.useHermesNightly=false

Also ran:

git diff --check

@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 2, 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 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.

Android ReactActivity Destroy Prevents Successful OnActivityResult Calls

1 participant