Fix native animated mount flash#57391
Open
GrahamCampbell wants to merge 3 commits into
Open
Conversation
zeyap
reviewed
Jun 30, 2026
| } | ||
| updatedNodeTags_.insert(node->tag()); | ||
| // Seed props_ so getManagedProps() is live the instant the view is managed. | ||
| node->update(); |
Contributor
There was a problem hiding this comment.
Suggested change
| node->update(); | |
| node->update(/*forceFabricCommit*/ true); |
Contributor
|
@GrahamCampbell thanks for the PR, do you have a playground repro for this issue? In fact Props |
Author
|
Thanks for the review. |
Author
|
I've pushed a reproducer to https://github.com/GrahamCampbell/react-native/tree/native-animated-mount-flash-repro in GrahamCampbell@fa7f342. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
The C++ native animated backend (
cxxNativeAnimatedEnabled) prevents theuseNativeDriverfirst-frame flash by havingAnimatedMountingOverrideDelegatere-merge a view's live animated props (getManagedProps) onto mountUpdatemutations, so a stale JS re-render can't reach the screen. There is a residual at connect time:connectAnimatedNodeToViewregisters the view (the override starts overriding it) but never runs the props node, sogetManagedProps()returns an empty object until the next animation frame. If a Fabric mount transaction is pulled in that window the override has nothing to merge and the un-driven default value flashes for one frame, most visibly when a brand-new view is connected to an already mid-flight sharedAnimated.Value.This seeds the props node with
node->update()at the end ofconnectAnimatedNodeToViewsogetManagedProps()is live the instant the view becomes managed. No manager mutex is held at that point andupdate()takes only the node-local props mutex, so it is lock-safe; it is idempotent with the per-frame update and adds no extra Fabric commit because it only stages. It closes the connect-while-Update-in-flight case and mitigates the brand-new-view (Insert) first-paint case; the override only rewritesUpdate/Deletemutations today, so fully closingInsertis a follow-up. It also adds the missing unit coverage for thegetManagedProps/hasManagedPropsseam the override depends on.Changelog:
[INTERNAL] [FIXED] - Seed managed props when a view connects to the native animated backend so they are live before the first frame, shrinking the useNativeDriver mount flash
Test Plan:
Adds
ManagedPropsMountingOverrideTests.cppto the ReactCommon animated unit tests.getManagedPropsReflectsLiveValueAcrossFrames,getManagedPropsNullForUnconnectedView,hasManagedPropsTracksConnectAndDisconnectandgetManagedPropsIsolatedPerViewpin the seam and pass regardless of the change.getManagedPropsLiveImmediatelyOnConnectandgetManagedPropsLiveOnConnectWhileValueMidFlightare the regression cases: they fail without the seed (empty props at connect) and pass with it. Run via the animated C++ unit test target. On-device verification (iOS and Android withcxxNativeAnimatedEnabledon, frame-stepped capture of a popover/menu open) is still recommended for the user-visible flash.