Skip to content

cherry-pick(4.4-stable): Preserve builder subclass type through static animation modifiers (#9710)#9735

Merged
MatiPl01 merged 1 commit into
4.4-stablefrom
@matipl01/4.4-stable/cherry-pick-#9710
Jun 23, 2026
Merged

cherry-pick(4.4-stable): Preserve builder subclass type through static animation modifiers (#9710)#9735
MatiPl01 merged 1 commit into
4.4-stablefrom
@matipl01/4.4-stable/cherry-pick-#9710

Conversation

@MatiPl01

Copy link
Copy Markdown
Member

Summary

Cherry-picking for Reanimated 4.4.2 release

#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.
@MatiPl01 MatiPl01 merged commit 19a5ef6 into 4.4-stable Jun 23, 2026
13 checks passed
@MatiPl01 MatiPl01 deleted the @matipl01/4.4-stable/cherry-pick-#9710 branch June 23, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants