Skip to content

fix(react-motion): apply MotionComponent type to presence definition#35952

Merged
layershifter merged 2 commits intomicrosoft:masterfrom
robertpenner:refactor/motion-component-types
Apr 7, 2026
Merged

fix(react-motion): apply MotionComponent type to presence definition#35952
layershifter merged 2 commits intomicrosoft:masterfrom
robertpenner:refactor/motion-component-types

Conversation

@robertpenner
Copy link
Copy Markdown
Collaborator

@robertpenner robertpenner commented Apr 6, 2026

Previous Behavior

  • The In and Out properties of PresenceComponent were typed as React.FC<MotionComponentProps & MotionParams>.
  • This typing was missing [MOTION_DEFINITION]: AtomMotionFn<MotionParams>
  • This resulted in a type error when trying to make variants of Slide.In, for example, with createMotionComponentVariant.

New Behavior

  • The In and Out properties of PresenceComponent are now typed as MotionComponent<MotionParams>.
  • This is more ergonomic than the React.FC expression, and it contains the special MOTION_DEFINITION symbol.
  • Thus, createMotionComponentVariant(Slide.In, { duration: 2000 }) now works without a type error.

Future Work

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

📊 Bundle size report

✅ No changes found

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

Pull request demo site: URL

@robertpenner robertpenner marked this pull request as ready for review April 6, 2026 11:19
@robertpenner robertpenner requested review from a team as code owners April 6, 2026 11:19
@robertpenner robertpenner force-pushed the refactor/motion-component-types branch from 322ba3f to 83458ce Compare April 7, 2026 02:46
@layershifter layershifter merged commit ba68f3a into microsoft:master Apr 7, 2026
12 checks passed
@robertpenner robertpenner deleted the refactor/motion-component-types branch April 7, 2026 19:24
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