Repository navigation
Keep static styles set after a native-driver animation with the shared animation backend - #60604
Open
Nishant-96 wants to merge 1 commit into
Open
Nishant-96 wants to merge 1 commit into
Nishant-96 wants to merge 1 commit into
Conversation
…d animation backend Fixes react#60603. Signed-off-by: Nishant Pratihast <87017414+Nishant-96@users.noreply.github.com>
Nishant-96
force-pushed
the
fix-static-style-after-native-animation
branch
from
December 5, 2026 21:52
86b8eb0 to
911998d
Compare
This branch has not been deployed
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:
Fixes #60603.
With the shared animation backend, if a view finishes a
useNativeDriver: trueanimation and you then give it a static value for the same prop, it keeps the last animated value. Fade to 0.2, switch toopacity: 0.6, and it stays at 0.2.Three things put the old value back:
AnimationBackendCommitHookapplies the registry snapshot on top of React's commit, and the snapshot still has the animated value.SurfaceMountingManagerkeeps re-applying opacity/transform from the synchronous path on every mount until it gets a null, which never comes.What this changes:
AnimatedPropsnode stops driving a prop, JS releases it in the insertion effect, before React's commit, through a new optionalreleaseAnimatedProps. Values are processed with the view'svalidAttributes, and removed props go as null.clearSynchronousMountPropsOverride, a no-op elsewhere).This touches
SurfaceMountingManagerlike #60471, happy to rebase whichever lands first.Changelog:
[General] [Fixed] - Fix a view keeping its last native-driver animated value after switching to a static style with the shared animation backend
Test Plan:
AnimatedBackend-itest.jscompare the view after the switch with the same style rendered without an animation (opacity, transform, colors, layout props, removing the prop, switching mid-animation, a prop that keeps animating, a shared value, switching twice). 124/124 pass. Without the JS release call, 34 fail.AnimatedPropsRegistryTestfor the release and for dropping late updates, run through the Fantom tester build (animationbackend, animated, uimanager, scheduler suites all pass). Disabling the filter fails the two late-update tests.SurfaceMountingManagerSynchronousMountPropsTest, 13/13.yarn jest(Animated), flow, lint, formatters,build-types --validate,android-api-validate, C++ API snapshots regenerated.0.90.0-nightly-20261205in Release on the iOS simulator and an Android emulator (ReactAndroid built from source). Before is the stock nightly, after has this patch, same taps:iOS:
Android: