react-native-ease 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ease",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Lightweight declarative animations powered by platform APIs",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -19,6 +19,7 @@
19
19
  "ios",
20
20
  "cpp",
21
21
  "*.podspec",
22
+ "skills",
22
23
  "!ios/build",
23
24
  "!android/build",
24
25
  "!android/gradle",
@@ -28,7 +29,8 @@
28
29
  "!**/__tests__",
29
30
  "!**/__fixtures__",
30
31
  "!**/__mocks__",
31
- "!**/.*"
32
+ "!**/.*",
33
+ ".claude-plugin"
32
34
  ],
33
35
  "scripts": {
34
36
  "example": "yarn workspace react-native-ease-example",
@@ -53,14 +55,14 @@
53
55
  ],
54
56
  "repository": {
55
57
  "type": "git",
56
- "url": "git+https://github.com/janicduplessis/react-native-ease.git"
58
+ "url": "git+https://github.com/AppAndFlow/react-native-ease.git"
57
59
  },
58
60
  "author": "Janic Duplessis <janic@appandflow.com> (https://github.com/janicduplessis)",
59
61
  "license": "MIT",
60
62
  "bugs": {
61
- "url": "https://github.com/janicduplessis/react-native-ease/issues"
63
+ "url": "https://github.com/AppAndFlow/react-native-ease/issues"
62
64
  },
63
- "homepage": "https://github.com/janicduplessis/react-native-ease#readme",
65
+ "homepage": "https://github.com/AppAndFlow/react-native-ease#readme",
64
66
  "publishConfig": {
65
67
  "registry": "https://registry.npmjs.org/"
66
68
  },
@@ -0,0 +1,405 @@
1
+ ---
2
+ name: react-native-ease-refactor
3
+ description: Scan for Animated/Reanimated code and migrate to EaseView
4
+ user-invocable: true
5
+ ---
6
+
7
+ # react-native-ease refactor
8
+
9
+ You are a migration assistant that converts `react-native-reanimated` and React Native's built-in `Animated` API code to `react-native-ease` `EaseView` components.
10
+
11
+ Follow these 6 phases exactly. Do not skip phases or reorder them.
12
+
13
+ ---
14
+
15
+ ## Phase 1: Discovery
16
+
17
+ Scan the user's project for animation code:
18
+
19
+ 1. Use Grep to find all files importing from `react-native-reanimated`:
20
+
21
+ - Pattern: `from ['"]react-native-reanimated['"]`
22
+ - Search in `**/*.{ts,tsx,js,jsx}`
23
+
24
+ 2. Use Grep to find all files using React Native's built-in `Animated` API:
25
+
26
+ - Pattern: `from ['"]react-native['"]` that also use `Animated`
27
+ - Pattern: `Animated\.View|Animated\.Text|Animated\.Image|Animated\.Value|Animated\.timing|Animated\.spring`
28
+
29
+ 3. Use Grep to find files already using `react-native-ease` (to avoid re-migrating):
30
+
31
+ - Pattern: `from ['"]react-native-ease['"]`
32
+
33
+ 4. Read each file that contains animation code. Build a list of components with their animation patterns.
34
+
35
+ **Exclude** from scanning:
36
+
37
+ - `node_modules/`
38
+ - `*.test.*` and `*.spec.*` files
39
+ - Build output directories (`lib/`, `build/`, `dist/`)
40
+
41
+ ---
42
+
43
+ ## Phase 2: Classification
44
+
45
+ For each component found, classify as **migratable** or **not migratable**.
46
+
47
+ ### Decision Tree
48
+
49
+ Apply these checks in order. The first match determines the result:
50
+
51
+ 1. **Uses gesture APIs?** (`Gesture.Pan`, `Gesture.Pinch`, `Gesture.Rotation`, `useAnimatedGestureHandler`) → NOT migratable — "Gesture-driven animation"
52
+ 2. **Uses scroll handler?** (`useAnimatedScrollHandler`, `onScroll` with `Animated.event`) → NOT migratable — "Scroll-driven animation"
53
+ 3. **Uses shared element transitions?** (`sharedTransitionTag`) → NOT migratable — "Shared element transition"
54
+ 4. **Uses `runOnUI` or worklet directives?** → NOT migratable — "Requires worklet runtime"
55
+ 5. **Uses `withSequence`?** → NOT migratable — "Animation sequencing not supported"
56
+ 5b. **Uses `withDelay` wrapping a single animation (`withTiming`/`withSpring`)?** → MIGRATABLE — map to `delay` on the transition
57
+ 5c. **Uses `withDelay` wrapping `withSequence` or nested `withDelay`?** → NOT migratable — "Complex delay/sequencing not supported"
58
+ 6. **Uses complex `interpolate()`?** (more than 2 input/output values) → NOT migratable — "Complex interpolation"
59
+ 7. **Uses `layout={...}` prop?** → NOT migratable — "Layout animation"
60
+ 8. **Animates unsupported properties?** (anything besides: opacity, translateX, translateY, scale, scaleX, scaleY, rotate, rotateX, rotateY, borderRadius, backgroundColor) → NOT migratable — "Animates unsupported property: `<prop>`"
61
+ 9. **Uses different transition configs per property?** (e.g., opacity uses 200ms timing, scale uses spring) → NOT migratable — "Per-property transition configs"
62
+ 10. **Not driven by state?** (animation triggered by gesture/scroll value, not React state) → NOT migratable — "Not state-driven"
63
+ 11. **Otherwise** → MIGRATABLE
64
+
65
+ ### Migratable Pattern Mapping
66
+
67
+ Use this table to convert Reanimated/Animated patterns to EaseView:
68
+
69
+ | Reanimated / Animated Pattern | EaseView Equivalent |
70
+ | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
71
+ | `useSharedValue` + `useAnimatedStyle` + `withTiming` for opacity, translate, scale, rotate, borderRadius, backgroundColor | `animate={{ prop: value }}` + `transition={{ type: 'timing', duration, easing }}` |
72
+ | `withSpring` | `transition={{ type: 'spring', damping, stiffness, mass }}` |
73
+ | `entering={FadeIn}` / `FadeIn.duration(N)` | `initialAnimate={{ opacity: 0 }}` + `animate={{ opacity: 1 }}` + timing transition |
74
+ | `entering={FadeInDown}` / `FadeInUp` | `initialAnimate={{ opacity: 0, translateY: ±value }}` + `animate={{ opacity: 1, translateY: 0 }}` |
75
+ | `entering={SlideInLeft}` / `SlideInRight` | `initialAnimate={{ translateX: ±value }}` + `animate={{ translateX: 0 }}` |
76
+ | `entering={SlideInUp}` / `SlideInDown` | `initialAnimate={{ translateY: ±value }}` + `animate={{ translateY: 0 }}` |
77
+ | `entering={ZoomIn}` | `initialAnimate={{ scale: 0 }}` + `animate={{ scale: 1 }}` |
78
+ | `exiting={FadeOut}` / other exit animations | State-driven exit: boolean state + `onTransitionEnd` to unmount (flag as "requires state changes" in report) |
79
+ | `withRepeat(withTiming(...), -1, false)` | `transition={{ type: 'timing', ..., loop: 'repeat' }}` + `initialAnimate` for start value |
80
+ | `withRepeat(withTiming(...), -1, true)` | `transition={{ type: 'timing', ..., loop: 'reverse' }}` + `initialAnimate` for start value |
81
+ | `Easing.linear` | `easing: 'linear'` |
82
+ | `Easing.ease` / `Easing.inOut(Easing.ease)` | `easing: 'easeInOut'` |
83
+ | `Easing.in(Easing.ease)` | `easing: 'easeIn'` |
84
+ | `Easing.out(Easing.ease)` | `easing: 'easeOut'` |
85
+ | `Easing.bezier(x1, y1, x2, y2)` | `easing: [x1, y1, x2, y2]` |
86
+ | `Animated.Value` + `Animated.timing` | Same `animate` + `transition` pattern — convert to state-driven |
87
+ | `Animated.Value` + `Animated.spring` | `animate` + `transition={{ type: 'spring' }}` — convert to state-driven |
88
+ | `withDelay(ms, withTiming(...))` or `withDelay(ms, withSpring(...))` | `transition={{ ..., delay: ms }}` — add `delay` to the transition config |
89
+ | `entering={FadeIn.delay(ms)}` / any entering preset with `.delay()` | `initialAnimate` + `animate` + `transition={{ ..., delay: ms }}` |
90
+
91
+ ### Default Value Mapping
92
+
93
+ **CRITICAL: Reanimated and EaseView have different defaults. You MUST explicitly set values to preserve the original animation behavior. Do not rely on EaseView defaults matching Reanimated defaults.**
94
+
95
+ #### `withSpring` → EaseView spring
96
+
97
+ | Parameter | Reanimated default | EaseView default | Action |
98
+ |---|---|---|---|
99
+ | `damping` | `10` | `15` | **Must set `damping: 10`** |
100
+ | `stiffness` | `100` | `120` | **Must set `stiffness: 100`** |
101
+ | `mass` | `1` | `1` | Same — omit |
102
+
103
+ If the source code explicitly sets any of these values, carry them over as-is. If the source relies on Reanimated defaults (no explicit value), set the Reanimated default explicitly on the EaseView transition.
104
+
105
+ Example — bare `withSpring(1)` with no config:
106
+ ```typescript
107
+ // Before (Reanimated)
108
+ scale.value = withSpring(1);
109
+
110
+ // After (EaseView) — must set damping: 10, stiffness: 100 to match
111
+ transition={{ type: 'spring', damping: 10, stiffness: 100 }}
112
+ ```
113
+
114
+ **Note:** Reanimated v3+ uses duration-based spring by default (`duration: 550`, `dampingRatio: 1`) when no physics params are set. If migrating code that uses `withSpring` without any config, use `damping: 10, stiffness: 100` which matches the physics-based fallback. If the code explicitly sets `dampingRatio`/`duration`, convert using: `damping = dampingRatio * 2 * sqrt(stiffness * mass)`.
115
+
116
+ #### `withTiming` → EaseView timing
117
+
118
+ | Parameter | Reanimated default | EaseView default | Action |
119
+ |---|---|---|---|
120
+ | `duration` | `300` | `300` | Same — omit |
121
+ | `easing` | `Easing.inOut(Easing.quad)` | `'easeInOut'` (cubic) | **Must set `easing: [0.455, 0.03, 0.515, 0.955]`** |
122
+
123
+ The easing curves are different! Reanimated's default is quadratic ease-in-out, EaseView's is cubic. Always set the easing explicitly when the source doesn't specify one.
124
+
125
+ Example — bare `withTiming(1)` with no config:
126
+ ```typescript
127
+ // Before (Reanimated)
128
+ opacity.value = withTiming(1);
129
+
130
+ // After (EaseView) — must set quad easing to match
131
+ transition={{ type: 'timing', duration: 300, easing: [0.455, 0.03, 0.515, 0.955] }}
132
+ ```
133
+
134
+ If the source explicitly sets an easing, map it using the easing table above.
135
+
136
+ #### `Animated.timing` (old RN API) → EaseView timing
137
+
138
+ | Parameter | RN Animated default | EaseView default | Action |
139
+ |---|---|---|---|
140
+ | `duration` | `500` | `300` | **Must set `duration: 500`** |
141
+ | `easing` | `Easing.inOut(Easing.ease)` | `'easeInOut'` | Same curve — omit |
142
+
143
+ #### `Animated.spring` (old RN API) → EaseView spring
144
+
145
+ RN Animated uses `friction`/`tension` by default: `friction: 7, tension: 40`. These map to: `stiffness = tension`, `damping = friction`.
146
+
147
+ | Parameter | RN Animated default | EaseView default | Action |
148
+ |---|---|---|---|
149
+ | stiffness (tension) | `40` | `120` | **Must set `stiffness: 40`** |
150
+ | damping (friction) | `7` | `15` | **Must set `damping: 7`** |
151
+ | mass | `1` | `1` | Same — omit |
152
+
153
+ ### Unit Conversions
154
+
155
+ - **Rotation:** Reanimated uses `'45deg'` strings in transforms → EaseView uses `45` (number, degrees). Strip the `'deg'` suffix and parse to number.
156
+ - **Translation:** Both use DIPs (density-independent pixels). No conversion needed.
157
+ - **Scale:** Both use unitless multipliers. No conversion needed.
158
+
159
+ ---
160
+
161
+ ## Phase 3: Dry-Run Report
162
+
163
+ **ALWAYS print this report before asking the user to select components. This report must be visible to the user before Phase 4.**
164
+
165
+ Print a structured report. Do NOT apply any changes yet.
166
+
167
+ Format:
168
+
169
+ ```
170
+ ## Migration Report
171
+
172
+ ### Summary
173
+ - Files scanned: X
174
+ - Components with animations: Y
175
+ - Migratable: Z | Not migratable: W
176
+
177
+ ### Migratable Components
178
+
179
+ #### `path/to/file.tsx` — ComponentName
180
+ **Current:** Brief description of what the animation does and which API it uses
181
+ **Proposed:** What the EaseView equivalent looks like (include exact transition values with mapped defaults)
182
+ **Changes:** What will be added/removed/modified
183
+ **Note:** (only if applicable) "Requires state changes for exit animation" or other caveats
184
+
185
+ ### Not Migratable (will be skipped)
186
+
187
+ #### `path/to/file.tsx` — ComponentName
188
+ **Reason:** Why it can't be migrated (from decision tree)
189
+ ```
190
+
191
+ This report MUST be printed as text output in the conversation — not inside a plan, not collapsed. The user needs to read it before selecting components in Phase 4.
192
+
193
+ ---
194
+
195
+ ## Phase 4: User Confirmation
196
+
197
+ **CRITICAL: You MUST use the `AskUserQuestion` tool here. Do NOT use plan mode, do NOT use text prompts, do NOT ask inline. Call the `AskUserQuestion` tool directly.**
198
+
199
+ Call `AskUserQuestion` with these exact parameters:
200
+ - `multiSelect`: `true`
201
+ - `questions`: a single question object with:
202
+ - `header`: `"Migrate"`
203
+ - `question`: `"Which components should be migrated to EaseView? All are selected — deselect any to skip."`
204
+ - `multiSelect`: `true`
205
+ - `options`: one entry per migratable component, each with:
206
+ - `label`: the component name (e.g., `"AnimatedButton"`)
207
+ - `description`: file path and brief animation description (e.g., `"src/components/animated-button.tsx — spring scale on press"`)
208
+
209
+ Example tool call for 2 migratable components:
210
+
211
+ ```json
212
+ {
213
+ "questions": [
214
+ {
215
+ "header": "Migrate",
216
+ "question": "Which components should be migrated to EaseView? All are selected — deselect any to skip.",
217
+ "multiSelect": true,
218
+ "options": [
219
+ {
220
+ "label": "AnimatedButton",
221
+ "description": "src/components/simple/animated-button.tsx — spring scale on press"
222
+ },
223
+ {
224
+ "label": "Collapsible",
225
+ "description": "src/components/ui/collapsible.tsx — fade-in entering animation"
226
+ }
227
+ ]
228
+ }
229
+ ]
230
+ }
231
+ ```
232
+
233
+ **Wait for the user's response before proceeding.** Do not enter plan mode. Do not apply any changes without the user selecting components.
234
+
235
+ If the user selects nothing or chooses "Other" to cancel, abort with: "Migration aborted. No changes were made."
236
+
237
+ Only proceed to Phase 5 with the components the user confirmed.
238
+
239
+ ---
240
+
241
+ ## Phase 5: Apply Migrations
242
+
243
+ For each confirmed component, apply the migration:
244
+
245
+ ### Migration Steps (per component)
246
+
247
+ 1. **Add EaseView import** if not already present:
248
+
249
+ ```typescript
250
+ import { EaseView } from 'react-native-ease';
251
+ ```
252
+
253
+ 2. **Replace the animated view:**
254
+
255
+ - `Animated.View` → `EaseView`
256
+ - `<Animated.View style={[styles.box, animatedStyle]}>` → `<EaseView style={styles.box} animate={{ ... }} transition={{ ... }}>`
257
+
258
+ 3. **Convert animation hooks to props:**
259
+
260
+ - Remove `useSharedValue`, `useAnimatedStyle`, `withTiming`, `withSpring`, `withRepeat` calls
261
+ - Convert their values into `animate`, `initialAnimate`, and `transition` props
262
+
263
+ 4. **Convert entering/exiting animations:**
264
+
265
+ - `entering={FadeIn}` → `initialAnimate={{ opacity: 0 }}` on the EaseView + `animate={{ opacity: 1 }}`
266
+ - For `exiting`: introduce a state variable and `onTransitionEnd` callback:
267
+
268
+ ```typescript
269
+ const [visible, setVisible] = useState(true);
270
+ const [mounted, setMounted] = useState(true);
271
+
272
+ // When triggering exit:
273
+ setVisible(false);
274
+
275
+ // On the EaseView:
276
+ {
277
+ mounted && (
278
+ <EaseView
279
+ animate={{ opacity: visible ? 1 : 0 }}
280
+ transition={{ type: 'timing', duration: 300 }}
281
+ onTransitionEnd={({ finished }) => {
282
+ if (finished && !visible) setMounted(false);
283
+ }}
284
+ >
285
+ ...
286
+ </EaseView>
287
+ );
288
+ }
289
+ ```
290
+
291
+ 5. **Clean up imports:**
292
+
293
+ - Remove Reanimated imports that are no longer used in the file
294
+ - Keep any Reanimated imports still referenced by non-migrated code in the same file
295
+ - Never remove imports that are still used
296
+
297
+ 6. **Print progress:**
298
+ ```
299
+ [1/N] Migrated ComponentName in path/to/file.tsx
300
+ ```
301
+
302
+ ### Safety Rules
303
+
304
+ These rules are non-negotiable. Violating them corrupts user code.
305
+
306
+ 1. **When in doubt, skip.** If a pattern is ambiguous or you're not confident in the migration, add it to "Not Migratable" with reason: "Complex pattern — manual review recommended"
307
+ 2. **Never remove imports still used elsewhere in the file.** After removing animation code, check every remaining line for references to each import before removing it.
308
+ 3. **Preserve all non-animation logic.** Event handlers, state management, effects, callbacks — touch none of it unless directly related to the animation being migrated.
309
+ 4. **Preserve component structure and public API.** Props, ref forwarding, exported types — keep them identical.
310
+ 5. **Handle mixed files correctly.** If a file has both migratable and non-migratable animations, only migrate the safe ones. Keep Reanimated imports if any Reanimated code remains.
311
+ 6. **Map rotation units correctly.** Reanimated `'45deg'` string → EaseView `45` number. If the source uses radians, convert: `radians * (180 / Math.PI)`.
312
+ 7. **Map easing presets correctly.** See the mapping table in Phase 2.
313
+ 8. **Do not introduce TypeScript errors.** Ensure all types are correct after migration. If the original code uses typed shared values, ensure the EaseView props match.
314
+
315
+ ---
316
+
317
+ ## Phase 6: Final Report
318
+
319
+ After all migrations are applied, print:
320
+
321
+ ```
322
+ ## Migration Complete
323
+
324
+ ### Changed (X components)
325
+ - `path/to/file.tsx` — ComponentName: brief description of what was migrated
326
+
327
+ ### Unchanged (Y components)
328
+ - `path/to/file.tsx` — ComponentName: reason skipped
329
+
330
+ ### Next Steps
331
+ - Run your app and verify animations visually
332
+ - Run your test suite to check for regressions
333
+ - If no Reanimated code remains, consider removing `react-native-reanimated` from dependencies
334
+ ```
335
+
336
+ ---
337
+
338
+ ## EaseView API Reference (for migration accuracy)
339
+
340
+ ### Supported Animatable Properties
341
+
342
+ All properties in the `animate` prop:
343
+
344
+ | Property | Type | Default | Notes |
345
+ | ----------------- | ------------ | --------------- | ------------------------------------ |
346
+ | `opacity` | `number` | `1` | 0–1 range |
347
+ | `translateX` | `number` | `0` | In DIPs (density-independent pixels) |
348
+ | `translateY` | `number` | `0` | In DIPs |
349
+ | `scale` | `number` | `1` | Shorthand for scaleX + scaleY |
350
+ | `scaleX` | `number` | `1` | Overrides scale for X axis |
351
+ | `scaleY` | `number` | `1` | Overrides scale for Y axis |
352
+ | `rotate` | `number` | `0` | Z-axis rotation in degrees |
353
+ | `rotateX` | `number` | `0` | X-axis rotation in degrees (3D) |
354
+ | `rotateY` | `number` | `0` | Y-axis rotation in degrees (3D) |
355
+ | `borderRadius` | `number` | `0` | In pixels |
356
+ | `backgroundColor` | `ColorValue` | `'transparent'` | Any RN color value |
357
+
358
+ ### Transition Types
359
+
360
+ **Timing:**
361
+
362
+ ```typescript
363
+ transition={{
364
+ type: 'timing',
365
+ duration: 300, // ms, default 300
366
+ easing: 'easeInOut', // 'linear' | 'easeIn' | 'easeOut' | 'easeInOut' | [x1,y1,x2,y2]
367
+ delay: 0, // ms, default 0
368
+ loop: 'repeat', // 'repeat' | 'reverse' — requires initialAnimate
369
+ }}
370
+ ```
371
+
372
+ **Spring:**
373
+
374
+ ```typescript
375
+ transition={{
376
+ type: 'spring',
377
+ damping: 15, // default 15
378
+ stiffness: 120, // default 120
379
+ mass: 1, // default 1
380
+ delay: 0, // ms, default 0
381
+ }}
382
+ ```
383
+
384
+ **None (instant):**
385
+
386
+ ```typescript
387
+ transition={{ type: 'none' }}
388
+ ```
389
+
390
+ ### Key Props
391
+
392
+ - `animate` — target values for animated properties
393
+ - `initialAnimate` — starting values (animates to `animate` on mount)
394
+ - `transition` — animation config (timing or spring)
395
+ - `onTransitionEnd` — callback with `{ finished: boolean }`
396
+ - `transformOrigin` — pivot point as `{ x: 0-1, y: 0-1 }`, default center
397
+ - `useHardwareLayer` — Android GPU optimization (boolean, default false)
398
+
399
+ ### Important Constraints
400
+
401
+ - **Loop requires timing** (not spring) and `initialAnimate` must define the start value
402
+ - **No per-property transitions** — one transition config applies to all animated properties
403
+ - **No animation sequencing** — no equivalent to `withSequence`. Simple `withDelay` IS supported via the `delay` transition prop
404
+ - **No gesture/scroll-driven animations** — EaseView is state-driven only
405
+ - **Style/animate conflict** — if a property appears in both `style` and `animate`, the animated value wins
package/src/EaseView.tsx CHANGED
@@ -1,8 +1,9 @@
1
1
  import { StyleSheet, type ViewProps, type ViewStyle } from 'react-native';
2
- import NativeEaseView from './EaseViewNativeComponent';
2
+ import NativeEaseView, { type NativeProps } from './EaseViewNativeComponent';
3
3
  import type {
4
4
  AnimateProps,
5
5
  CubicBezier,
6
+ SingleTransition,
6
7
  Transition,
7
8
  TransitionEndEvent,
8
9
  TransformOrigin,
@@ -58,6 +59,115 @@ const EASING_PRESETS: Record<string, CubicBezier> = {
58
59
  easeInOut: [0.42, 0, 0.58, 1],
59
60
  };
60
61
 
62
+ /** Returns true if the transition is a SingleTransition (has a `type` field). */
63
+ function isSingleTransition(t: Transition): t is SingleTransition {
64
+ return 'type' in t;
65
+ }
66
+
67
+ type NativeTransitions = NonNullable<NativeProps['transitions']>;
68
+ type NativeTransitionConfig = NativeTransitions['defaultConfig'];
69
+
70
+ /** Default config: timing 300ms easeInOut. */
71
+ const DEFAULT_CONFIG: NativeTransitionConfig = {
72
+ type: 'timing',
73
+ duration: 300,
74
+ easingBezier: [0.42, 0, 0.58, 1],
75
+ damping: 15,
76
+ stiffness: 120,
77
+ mass: 1,
78
+ loop: 'none',
79
+ delay: 0,
80
+ };
81
+
82
+ /** Resolve a SingleTransition into a native config object. */
83
+ function resolveSingleConfig(config: SingleTransition): NativeTransitionConfig {
84
+ const type = config.type as string;
85
+ const duration = config.type === 'timing' ? config.duration ?? 300 : 300;
86
+ const rawEasing =
87
+ config.type === 'timing' ? config.easing ?? 'easeInOut' : 'easeInOut';
88
+ if (__DEV__) {
89
+ if (Array.isArray(rawEasing)) {
90
+ if ((rawEasing as number[]).length !== 4) {
91
+ console.warn(
92
+ 'react-native-ease: Custom easing must be a [x1, y1, x2, y2] tuple (got length ' +
93
+ (rawEasing as number[]).length +
94
+ ').',
95
+ );
96
+ }
97
+ if (
98
+ rawEasing[0] < 0 ||
99
+ rawEasing[0] > 1 ||
100
+ rawEasing[2] < 0 ||
101
+ rawEasing[2] > 1
102
+ ) {
103
+ console.warn(
104
+ 'react-native-ease: Easing x-values (x1, x2) must be between 0 and 1.',
105
+ );
106
+ }
107
+ }
108
+ }
109
+ const easingBezier: number[] = Array.isArray(rawEasing)
110
+ ? rawEasing
111
+ : EASING_PRESETS[rawEasing]!;
112
+ const damping = config.type === 'spring' ? config.damping ?? 15 : 15;
113
+ const stiffness = config.type === 'spring' ? config.stiffness ?? 120 : 120;
114
+ const mass = config.type === 'spring' ? config.mass ?? 1 : 1;
115
+ const loop: string =
116
+ config.type === 'timing' ? config.loop ?? 'none' : 'none';
117
+ const delay =
118
+ config.type === 'timing' || config.type === 'spring'
119
+ ? config.delay ?? 0
120
+ : 0;
121
+ return {
122
+ type,
123
+ duration,
124
+ easingBezier,
125
+ damping,
126
+ stiffness,
127
+ mass,
128
+ loop,
129
+ delay,
130
+ };
131
+ }
132
+
133
+ /** Category keys that map to optional NativeTransitions fields. */
134
+ const CATEGORY_KEYS = [
135
+ 'transform',
136
+ 'opacity',
137
+ 'borderRadius',
138
+ 'backgroundColor',
139
+ ] as const;
140
+
141
+ /** Resolve the transition prop into a NativeTransitions struct. */
142
+ function resolveTransitions(transition?: Transition): NativeTransitions {
143
+ // No transition: timing default for all properties
144
+ if (transition == null) {
145
+ return { defaultConfig: DEFAULT_CONFIG };
146
+ }
147
+
148
+ // Single transition: set as defaultConfig only
149
+ if (isSingleTransition(transition)) {
150
+ return { defaultConfig: resolveSingleConfig(transition) };
151
+ }
152
+
153
+ // TransitionMap: resolve defaultConfig + only specified category keys
154
+ const defaultConfig = transition.default
155
+ ? resolveSingleConfig(transition.default)
156
+ : DEFAULT_CONFIG;
157
+
158
+ const result: NativeTransitions = { defaultConfig };
159
+
160
+ for (const key of CATEGORY_KEYS) {
161
+ const specific = transition[key];
162
+ if (specific != null) {
163
+ (result as Record<string, NativeTransitionConfig>)[key] =
164
+ resolveSingleConfig(specific);
165
+ }
166
+ }
167
+
168
+ return result;
169
+ }
170
+
61
171
  export type EaseViewProps = ViewProps & {
62
172
  /** Target values for animated properties. */
63
173
  animate?: AnimateProps;
@@ -86,6 +196,8 @@ export type EaseViewProps = ViewProps & {
86
196
  useHardwareLayer?: boolean;
87
197
  /** Pivot point for scale and rotation as 0–1 fractions. @default { x: 0.5, y: 0.5 } (center) */
88
198
  transformOrigin?: TransformOrigin;
199
+ /** NativeWind / Tailwind CSS class string. Requires NativeWind in your project. */
200
+ className?: string;
89
201
  };
90
202
 
91
203
  export function EaseView({
@@ -179,46 +291,8 @@ export function EaseView({
179
291
  }
180
292
  }
181
293
 
182
- // Resolve transition config
183
- const transitionType = transition?.type ?? 'timing';
184
- const transitionDuration =
185
- transition?.type === 'timing' ? transition.duration ?? 300 : 300;
186
- const rawEasing =
187
- transition?.type === 'timing'
188
- ? transition.easing ?? 'easeInOut'
189
- : 'easeInOut';
190
- if (__DEV__) {
191
- if (Array.isArray(rawEasing)) {
192
- if ((rawEasing as number[]).length !== 4) {
193
- console.warn(
194
- 'react-native-ease: Custom easing must be a [x1, y1, x2, y2] tuple (got length ' +
195
- (rawEasing as number[]).length +
196
- ').',
197
- );
198
- }
199
- if (
200
- rawEasing[0] < 0 ||
201
- rawEasing[0] > 1 ||
202
- rawEasing[2] < 0 ||
203
- rawEasing[2] > 1
204
- ) {
205
- console.warn(
206
- 'react-native-ease: Easing x-values (x1, x2) must be between 0 and 1.',
207
- );
208
- }
209
- }
210
- }
211
- const bezier: CubicBezier = Array.isArray(rawEasing)
212
- ? rawEasing
213
- : EASING_PRESETS[rawEasing]!;
214
- const transitionDamping =
215
- transition?.type === 'spring' ? transition.damping ?? 15 : 15;
216
- const transitionStiffness =
217
- transition?.type === 'spring' ? transition.stiffness ?? 120 : 120;
218
- const transitionMass =
219
- transition?.type === 'spring' ? transition.mass ?? 1 : 1;
220
- const transitionLoop =
221
- transition?.type === 'timing' ? transition.loop ?? 'none' : 'none';
294
+ // Resolve transition config into a fully-populated struct
295
+ const transitions = resolveTransitions(transition);
222
296
 
223
297
  const handleTransitionEnd = onTransitionEnd
224
298
  ? (event: { nativeEvent: { finished: boolean } }) =>
@@ -250,13 +324,7 @@ export function EaseView({
250
324
  initialAnimateRotateY={resolvedInitial.rotateY}
251
325
  initialAnimateBorderRadius={resolvedInitial.borderRadius}
252
326
  initialAnimateBackgroundColor={initialBgColor}
253
- transitionType={transitionType}
254
- transitionDuration={transitionDuration}
255
- transitionEasingBezier={bezier}
256
- transitionDamping={transitionDamping}
257
- transitionStiffness={transitionStiffness}
258
- transitionMass={transitionMass}
259
- transitionLoop={transitionLoop}
327
+ transitions={transitions}
260
328
  useHardwareLayer={useHardwareLayer}
261
329
  transformOriginX={transformOrigin?.x ?? 0.5}
262
330
  transformOriginY={transformOrigin?.y ?? 0.5}