cherry-pick(4.4-stable): Preserve builder subclass type through static animation modifiers (#9710)#9735
Merged
Conversation
#9710) Fixes #9706. Static config modifiers on `AnimationConfigBuilder` (`springify`, `dampingRatio`, `easing`, etc.) were typed to return `AnimationConfigBuilder`, collapsing any subclass down to the base type. Calling them through `SharedTransition` (e.g. `SharedTransition.springify(400).dampingRatio(1)`) lost `withInitialValues`/`withTargetValues`, so the result was no longer assignable to `sharedTransitionStyle` and failed to type-check (TS2739). The fix binds `this` to the concrete subclass and returns `InstanceType<T>` - the same pattern `BaseAnimationBuilder`'s static modifiers already use - so the chain preserves the receiver's type for every builder subclass. Layout transitions still extend `AnimationConfigBuilder` directly, so they don't gain `withInitialValues`/`withTargetValues` (consistent with #9259). Adds type tests for the regression and a guard for the layout-transition constraint.
tjzel
approved these changes
Jun 23, 2026
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
Cherry-picking for Reanimated 4.4.2 release