Commit d6be63a
feat(rn): add React Native support for motion presets (Fade, Move, Slide, Scale, Morph, Stagger, AnimateInteractions) (#3760)
* feat(rn): add React Native support for BaseMotion engine
Adds the native implementation of the shared BaseMotion animation engine
that powers Blade's motion presets (Fade, Move, Slide, Morph, Scale,
Stagger, AnimateInteractions).
- Renames BaseMotion.tsx -> BaseMotion.web.tsx (framer-motion + styled-components)
- Adds BaseMotion.native.tsx exporting the same public API
(MotionDiv, BaseMotionBox, BaseMotionEnhancerBox, BaseMotionEntryExit)
built on react-native-reanimated + styled-components/native
- Adds baseMotionInterpreter.native.ts: a declarative-variant -> reanimated
interpreter (resolveVariantStyle, parseTransform, useAnimatedVariant)
- Reuses shared useMotionVariants from baseMotionUtils.ts (no duplication)
- Adds Platform.Select types for animate / MotionMeta.innerRef
- Manual exit-before-unmount (runOnJS) replaces AnimatePresence
- Triggers: mount + tap at parity; hover/focus/in-view degrade to mount
- Morph ships degraded (color/radius/opacity); true FLIP/shared-element
and Stagger orchestration deferred to the wrapper migration batch
The 7 preset wrappers remain native stubs and will be migrated in a
follow-up batch on top of this engine.
Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: auto-heal PR — fix lint errors, update snapshots, add changeset
Co-authored-by: admin <admin>
* fix: add __DEV__ warning for color variant on native View and document as known Phase 1 limitation [resolved by agent]
Co-authored-by: admin <admin>
* test(web): update snapshots for BaseMotion styled-component rename
Renaming BaseMotion.tsx -> BaseMotion.web.tsx changes the
styled-components generated id (BaseMotion__StyledDiv ->
BaseMotionweb__StyledDiv), which surfaces in the web/SSR snapshots of
Stagger and ChatInput. Regenerate those snapshots; the change is a
cosmetic class-name id only, functionally identical.
Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: auto-heal PR via Slash PR Healer
- Fix TypeScript compilation errors in baseMotionInterpreter.native.ts:
replaced incorrect '(t: number) => number' easing type with
EasingFactoryFn from react-native-reanimated (matches existing
codebase pattern in makeBezier.native.ts and Rotate.native.tsx)
- Revert all unrelated changes: StepGroup native stubs, blade-svelte
CounterInput/Button/MinusIcon deletions, figma pattern creator
changes, CI workflow modifications, yarn.lock, and 3 unrelated
changesets
Co-authored-by: admin <admin>
* fix: auto-heal PR via Slash PR Healer
- Fix TypeScript build errors in baseMotionInterpreter.native.ts:
Easing.bezier returns EasingFunctionFactory while Easing.ease returns
EasingFunction — type ReanimatedEasing now accepts both. Also fix
array element narrowing for framer-motion ease values.
- Fix changeset formatting: use double quotes in
blade-svelte-counterinput-component.md (changesets require double quotes)
- Update snapshots for Stagger.web, Stagger.ssr, ChatInput.ssr tests
after BaseMotion.tsx → BaseMotion.web.tsx rename changed styled-components
class name hash
Co-authored-by: admin <admin>
* feat(rn): add React Native support for motion presets
Add native implementations for the 7 motion presets on top of the native
BaseMotion engine:
- Fade / Move / Slide / Scale — dedicated .native.tsx (bezier-array easing;
Slide handles 100vw/vh + keyframe collapse; Scale maps isHighlighted).
- Morph — degraded native tween (color/radius/opacity; no geometric FLIP) with
a platform-resolved AnimatePresence shim so the story bundles on RN.
- Stagger — hand-built per-child delay orchestration via context; adds withDelay
to baseMotionInterpreter.native (also fixes standalone delay props on native).
- AnimateInteractions — press-and-hold replaces hover; publishes isInteracting
via context which BaseMotion.native reads to drive on-animate-interactions
children. useFocusWithin.ts renamed to .web.ts.
Also:
- Un-exclude motion stories from RN Storybook + swap web-only story nodes for
cross-platform equivalents; add native no-op StoryRouter.
- patch-storybook-hermes.js: neutralise `new RegExp("...\p{}...")` string-form
Unicode property escapes in minified Storybook browser chunks (es-toolkit
CASE_SPLIT + jsdoc identifier regexes) that crash Hermes on RN 0.72.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: auto-heal PR via Slash PR Healer
Co-authored-by: admin <admin>
* fix: auto-heal PR via Slash PR Healer
Co-authored-by: admin <admin>
* fix(rn): make Stagger cascade correctly on native
Flatten Fragment children so Storybook args get per-child targets, drive enter/exit with timed visibility (forward, 80ms like web), and isolate Metro from sibling worktrees.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: address all review comments on PR #3738 [resolved by agent]
Co-authored-by: admin <admin>
* fix: resolve review comments — use parseUnit for scalar values, bump changeset to minor [resolved by agent]
Co-authored-by: admin <admin>
* fix(rn): resolve BaseMotion CI lint and native test failures
Move interactionHandleRef before use, prettier-format BaseMotion native sources, and re-wrap rerender calls with BladeProvider so theme context is preserved.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: auto-heal PR via Slash PR Healer
- Fix prettier formatting in baseMotionInterpreter.native.ts, test files
- Fix interactionHandleRef used-before-defined in BaseMotion.native.tsx
- Fix renderWithTheme.native.tsx to use wrapper option for rerender theme context
Co-authored-by: admin <admin>
* fix(rn): Morph layoutId FLIP so text morphs from center to top
Approximate web framer shared-element morph on native: stash window bounds
on unmount and FLIP the next Morph with the same layoutId from that pose
into its natural layout (Morph On Text: card center → page top).
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(rn): enable OnRouteChange stories with state-based stepper
Replace the native StepperRouterExample stub with a state-driven step UI so motion presets can demo route transitions without react-router, and nest Stagger under ChipGroup so chips cascade instead of animating in lockstep.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: resolve PR review comments — memory leaks, type safety, stale closures, regex escaping, docs [resolved by agent]
Co-authored-by: admin <admin>
* fix: auto-heal PR via Slash PR Healer
Co-authored-by: admin <admin>
* fix: auto-heal PR via Slash PR Healer
Co-authored-by: admin <admin>
* fix: auto-heal PR via Slash PR Healer - move early return after all hooks in Morph.native.tsx
Co-authored-by: admin <admin>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: rzp-slash[bot] <swe-agent@razorpay.com>1 parent bb934b3 commit d6be63a
42 files changed
Lines changed: 3820 additions & 115 deletions
File tree
- .changeset
- packages/blade
- .storybook/react-native
- scripts
- src
- components
- AnimateInteractions
- __tests__
- __snapshots__
- BaseMotion
- docs
- Fade
- __tests__
- __snapshots__
- Morph
- __tests__
- __snapshots__
- Move
- __tests__
- __snapshots__
- Scale
- __tests__
- __snapshots__
- Slide
- __tests__
- __snapshots__
- Stagger
- __tests__
- __snapshots__
- utils/storybook
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
15 | | - | |
16 | | - | |
17 | 14 | | |
18 | 15 | | |
19 | | - | |
20 | 16 | | |
21 | | - | |
22 | 17 | | |
23 | 18 | | |
24 | 19 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | | - | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
17 | 30 | | |
18 | 31 | | |
19 | 32 | | |
| |||
52 | 65 | | |
53 | 66 | | |
54 | 67 | | |
55 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
56 | 72 | | |
57 | 73 | | |
58 | 74 | | |
| |||
63 | 79 | | |
64 | 80 | | |
65 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
66 | 90 | | |
67 | 91 | | |
68 | 92 | | |
| |||
113 | 137 | | |
114 | 138 | | |
115 | 139 | | |
116 | | - | |
117 | | - | |
| 140 | + | |
| 141 | + | |
118 | 142 | | |
119 | 143 | | |
120 | 144 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
122 | 161 | | |
123 | 162 | | |
124 | 163 | | |
| |||
Lines changed: 60 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
1 | 4 | | |
2 | | - | |
3 | | - | |
4 | 5 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
10 | 51 | | |
11 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
12 | 64 | | |
13 | 65 | | |
14 | 66 | | |
Lines changed: 5 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
| 116 | + | |
122 | 117 | | |
123 | 118 | | |
124 | 119 | | |
| |||
173 | 168 | | |
174 | 169 | | |
175 | 170 | | |
176 | | - | |
177 | | - | |
178 | | - | |
| 171 | + | |
| 172 | + | |
179 | 173 | | |
180 | | - | |
| 174 | + | |
| 175 | + | |
181 | 176 | | |
182 | 177 | | |
183 | 178 | | |
| |||
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
5 | 15 | | |
6 | 16 | | |
7 | 17 | | |
8 | 18 | | |
| 19 | + | |
9 | 20 | | |
10 | 21 | | |
11 | 22 | | |
| |||
Lines changed: 82 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
0 commit comments