Skip to content

Commit 670e239

Browse files
authored
docs: update README and SKILL documentation to clarify transition configuration options (#16)
1 parent 21d83a7 commit 670e239

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ All properties are set in the `animate` prop as flat values (no transform array)
279279

280280
`scale` is a shorthand that sets both `scaleX` and `scaleY`. When `scaleX` or `scaleY` is also specified, it overrides the `scale` value for that axis.
281281

282-
You can animate any combination of properties simultaneously. All properties share the same transition config.
282+
You can animate any combination of properties simultaneously. Use a single transition config for all properties, or a [per-property map](#per-property-transitions) for different configs per category.
283283

284284
### Looping Animations
285285

@@ -415,10 +415,11 @@ A `View` that animates property changes using native platform APIs.
415415
| ------------------ | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
416416
| `animate` | `AnimateProps` | Target values for animated properties |
417417
| `initialAnimate` | `AnimateProps` | Starting values for enter animations (animates to `animate` on mount) |
418-
| `transition` | `Transition` | Animation configuration (timing, spring, or none) |
418+
| `transition` | `Transition` | Animation configuration — a single config (timing, spring, or none) or a [per-property map](#per-property-transitions) |
419419
| `onTransitionEnd` | `(event) => void` | Called when all animations complete with `{ finished: boolean }` |
420420
| `transformOrigin` | `{ x?: number; y?: number }` | Pivot point for scale/rotation as 0–1 fractions. Default: `{ x: 0.5, y: 0.5 }` (center) |
421421
| `useHardwareLayer` | `boolean` | Android only — rasterize to GPU texture during animations. See [Hardware Layers](#hardware-layers-android). Default: `false` |
422+
| `className` | `string` | NativeWind / Tailwind CSS class string. Requires NativeWind in your project. |
422423
| `style` | `ViewStyle` | Non-animated styles (layout, colors, borders, etc.) |
423424
| `children` | `ReactNode` | Child elements |
424425
| ...rest | `ViewProps` | All other standard View props |
@@ -475,6 +476,18 @@ Properties not specified in `animate` default to their identity values.
475476

476477
Applies values instantly with no animation. `onTransitionEnd` fires immediately with `{ finished: true }`.
477478

479+
### `TransitionMap`
480+
481+
A per-property map that applies different transition configs to different property categories. See [Per-Property Transitions](#per-property-transitions).
482+
483+
| Key | Properties |
484+
| ----------------- | ---------------------------------------------------------------- |
485+
| `default` | Fallback for categories not explicitly listed |
486+
| `transform` | translateX, translateY, scaleX, scaleY, rotate, rotateX, rotateY |
487+
| `opacity` | opacity |
488+
| `borderRadius` | borderRadius |
489+
| `backgroundColor` | backgroundColor |
490+
478491
## Hardware Layers (Android)
479492

480493
Setting `useHardwareLayer` rasterizes the view into a GPU texture for the duration of the animation. This means animated property changes (opacity, scale, rotation) are composited on the RenderThread without redrawing the view hierarchy — useful for complex views with many children.

skills/react-native-ease-refactor/SKILL.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Apply these checks in order. The first match determines the result:
5858
6. **Uses complex `interpolate()`?** (more than 2 input/output values) → NOT migratable — "Complex interpolation"
5959
7. **Uses `layout={...}` prop?** → NOT migratable — "Layout animation"
6060
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"
61+
9. **Uses different transition configs per property?** (e.g., opacity uses 200ms timing, scale uses spring) → MIGRATABLE — map to `TransitionMap` with category keys (`transform`, `opacity`, `borderRadius`, `backgroundColor`, `default`)
6262
10. **Not driven by state?** (animation triggered by gesture/scroll value, not React state) → NOT migratable — "Not state-driven"
6363
11. **Otherwise** → MIGRATABLE
6464

@@ -87,6 +87,7 @@ Use this table to convert Reanimated/Animated patterns to EaseView:
8787
| `Animated.Value` + `Animated.spring` | `animate` + `transition={{ type: 'spring' }}` — convert to state-driven |
8888
| `withDelay(ms, withTiming(...))` or `withDelay(ms, withSpring(...))` | `transition={{ ..., delay: ms }}` — add `delay` to the transition config |
8989
| `entering={FadeIn.delay(ms)}` / any entering preset with `.delay()` | `initialAnimate` + `animate` + `transition={{ ..., delay: ms }}` |
90+
| Different `withTiming`/`withSpring` per property in `useAnimatedStyle` | `transition={{ opacity: { type: 'timing', ... }, transform: { type: 'spring', ... } }}` (per-property map) |
9091

9192
### Default Value Mapping
9293

@@ -391,15 +392,16 @@ transition={{ type: 'none' }}
391392

392393
- `animate` — target values for animated properties
393394
- `initialAnimate` — starting values (animates to `animate` on mount)
394-
- `transition` — animation config (timing or spring)
395+
- `transition` — animation config: a single `SingleTransition` (timing/spring/none) OR a `TransitionMap` with category keys (`default`, `transform`, `opacity`, `borderRadius`, `backgroundColor`)
395396
- `onTransitionEnd` — callback with `{ finished: boolean }`
396397
- `transformOrigin` — pivot point as `{ x: 0-1, y: 0-1 }`, default center
397398
- `useHardwareLayer` — Android GPU optimization (boolean, default false)
399+
- `className` — NativeWind / Tailwind CSS class string (requires NativeWind in the project)
398400

399401
### Important Constraints
400402

401403
- **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
404+
- **Per-property transitions supported**pass a `TransitionMap` with category keys (`default`, `transform`, `opacity`, `borderRadius`, `backgroundColor`) to use different configs per property group
403405
- **No animation sequencing** — no equivalent to `withSequence`. Simple `withDelay` IS supported via the `delay` transition prop
404406
- **No gesture/scroll-driven animations** — EaseView is state-driven only
405407
- **Style/animate conflict** — if a property appears in both `style` and `animate`, the animated value wins

0 commit comments

Comments
 (0)