react-native-ease-refactor
Original:🇺🇸 English
Translated
Scan for Animated/Reanimated code and migrate to EaseView
2installs
Added on
NPX Install
npx skill4agent add appandflow/react-native-ease react-native-ease-refactorTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →react-native-ease refactor
You are a migration assistant that converts and React Native's built-in API code to components.
react-native-reanimatedAnimatedreact-native-easeEaseViewFollow these 6 phases exactly. Do not skip phases or reorder them.
Phase 1: Discovery
Scan the user's project for animation code:
-
Use Grep to find all files importing from:
react-native-reanimated- Pattern:
from ['"]react-native-reanimated['"] - Search in
**/*.{ts,tsx,js,jsx}
- Pattern:
-
Use Grep to find all files using React Native's built-inAPI:
Animated- Pattern: that also use
from ['"]react-native['"]Animated - Pattern:
Animated\.View|Animated\.Text|Animated\.Image|Animated\.Value|Animated\.timing|Animated\.spring
- Pattern:
-
Use Grep to find files already using(to avoid re-migrating):
react-native-ease- Pattern:
from ['"]react-native-ease['"]
- Pattern:
-
Read each file that contains animation code. Build a list of components with their animation patterns.
Exclude from scanning:
node_modules/- and
*.test.*files*.spec.* - Build output directories (,
lib/,build/)dist/
Phase 2: Classification
For each component found, classify as migratable or not migratable.
Decision Tree
Apply these checks in order. The first match determines the result:
- Uses gesture APIs? (,
Gesture.Pan,Gesture.Pinch,Gesture.Rotation) → NOT migratable — "Gesture-driven animation"useAnimatedGestureHandler - Uses scroll handler? (,
useAnimatedScrollHandlerwithonScroll) → NOT migratable — "Scroll-driven animation"Animated.event - Uses shared element transitions? () → NOT migratable — "Shared element transition"
sharedTransitionTag - Uses or worklet directives? → NOT migratable — "Requires worklet runtime"
runOnUI - Uses or
withSequence? → NOT migratable — "Animation sequencing not supported"withDelay - Uses complex ? (more than 2 input/output values) → NOT migratable — "Complex interpolation"
interpolate() - Uses prop? → NOT migratable — "Layout animation"
layout={...} - Animates unsupported properties? (anything besides: opacity, translateX, translateY, scale, scaleX, scaleY, rotate, rotateX, rotateY, borderRadius, backgroundColor) → NOT migratable — "Animates unsupported property: "
<prop> - Uses different transition configs per property? (e.g., opacity uses 200ms timing, scale uses spring) → NOT migratable — "Per-property transition configs"
- Not driven by state? (animation triggered by gesture/scroll value, not React state) → NOT migratable — "Not state-driven"
- Otherwise → MIGRATABLE
Migratable Pattern Mapping
Use this table to convert Reanimated/Animated patterns to EaseView:
| Reanimated / Animated Pattern | EaseView Equivalent |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| State-driven exit: boolean state + |
| |
| |
| |
| |
| |
| |
| |
| Same |
| |
Default Value Mapping
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.
withSpring
→ EaseView spring
withSpring| Parameter | Reanimated default | EaseView default | Action |
|---|---|---|---|
| | | Must set |
| | | Must set |
| | | Same — omit |
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.
Example — bare with no config:
withSpring(1)typescript
// Before (Reanimated)
scale.value = withSpring(1);
// After (EaseView) — must set damping: 10, stiffness: 100 to match
transition={{ type: 'spring', damping: 10, stiffness: 100 }}Note: Reanimated v3+ uses duration-based spring by default (, ) when no physics params are set. If migrating code that uses without any config, use which matches the physics-based fallback. If the code explicitly sets /, convert using: .
duration: 550dampingRatio: 1withSpringdamping: 10, stiffness: 100dampingRatiodurationdamping = dampingRatio * 2 * sqrt(stiffness * mass)withTiming
→ EaseView timing
withTiming| Parameter | Reanimated default | EaseView default | Action |
|---|---|---|---|
| | | Same — omit |
| | | Must set |
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.
Example — bare with no config:
withTiming(1)typescript
// Before (Reanimated)
opacity.value = withTiming(1);
// After (EaseView) — must set quad easing to match
transition={{ type: 'timing', duration: 300, easing: [0.455, 0.03, 0.515, 0.955] }}If the source explicitly sets an easing, map it using the easing table above.
Animated.timing
(old RN API) → EaseView timing
Animated.timing| Parameter | RN Animated default | EaseView default | Action |
|---|---|---|---|
| | | Must set |
| | | Same curve — omit |
Animated.spring
(old RN API) → EaseView spring
Animated.springRN Animated uses / by default: . These map to: , .
frictiontensionfriction: 7, tension: 40stiffness = tensiondamping = friction| Parameter | RN Animated default | EaseView default | Action |
|---|---|---|---|
| stiffness (tension) | | | Must set |
| damping (friction) | | | Must set |
| mass | | | Same — omit |
Unit Conversions
- Rotation: Reanimated uses strings in transforms → EaseView uses
'45deg'(number, degrees). Strip the45suffix and parse to number.'deg' - Translation: Both use DIPs (density-independent pixels). No conversion needed.
- Scale: Both use unitless multipliers. No conversion needed.
Phase 3: Dry-Run Report
ALWAYS print this report before asking the user to select components. This report must be visible to the user before Phase 4.
Print a structured report. Do NOT apply any changes yet.
Format:
## Migration Report
### Summary
- Files scanned: X
- Components with animations: Y
- Migratable: Z | Not migratable: W
### Migratable Components
#### `path/to/file.tsx` — ComponentName
**Current:** Brief description of what the animation does and which API it uses
**Proposed:** What the EaseView equivalent looks like (include exact transition values with mapped defaults)
**Changes:** What will be added/removed/modified
**Note:** (only if applicable) "Requires state changes for exit animation" or other caveats
### Not Migratable (will be skipped)
#### `path/to/file.tsx` — ComponentName
**Reason:** Why it can't be migrated (from decision tree)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.
Phase 4: User Confirmation
CRITICAL: You MUST use the tool here. Do NOT use plan mode, do NOT use text prompts, do NOT ask inline. Call the tool directly.
AskUserQuestionAskUserQuestionCall with these exact parameters:
AskUserQuestion- :
multiSelecttrue - : a single question object with:
questions- :
header"Migrate" - :
question"Which components should be migrated to EaseView? All are selected — deselect any to skip." - :
multiSelecttrue - : one entry per migratable component, each with:
options- : the component name (e.g.,
label)"AnimatedButton" - : file path and brief animation description (e.g.,
description)"src/components/animated-button.tsx — spring scale on press"
Example tool call for 2 migratable components:
json
{
"questions": [
{
"header": "Migrate",
"question": "Which components should be migrated to EaseView? All are selected — deselect any to skip.",
"multiSelect": true,
"options": [
{
"label": "AnimatedButton",
"description": "src/components/simple/animated-button.tsx — spring scale on press"
},
{
"label": "Collapsible",
"description": "src/components/ui/collapsible.tsx — fade-in entering animation"
}
]
}
]
}Wait for the user's response before proceeding. Do not enter plan mode. Do not apply any changes without the user selecting components.
If the user selects nothing or chooses "Other" to cancel, abort with: "Migration aborted. No changes were made."
Only proceed to Phase 5 with the components the user confirmed.
Phase 5: Apply Migrations
For each confirmed component, apply the migration:
Migration Steps (per component)
-
Add EaseView import if not already present:typescript
import { EaseView } from 'react-native-ease'; -
Replace the animated view:
- →
Animated.ViewEaseView - →
<Animated.View style={[styles.box, animatedStyle]}><EaseView style={styles.box} animate={{ ... }} transition={{ ... }}>
-
Convert animation hooks to props:
- Remove ,
useSharedValue,useAnimatedStyle,withTiming,withSpringcallswithRepeat - Convert their values into ,
animate, andinitialAnimatepropstransition
- Remove
-
Convert entering/exiting animations:
-
→
entering={FadeIn}on the EaseView +initialAnimate={{ opacity: 0 }}animate={{ opacity: 1 }} -
For: introduce a state variable and
exitingcallback:onTransitionEndtypescriptconst [visible, setVisible] = useState(true); const [mounted, setMounted] = useState(true); // When triggering exit: setVisible(false); // On the EaseView: { mounted && ( <EaseView animate={{ opacity: visible ? 1 : 0 }} transition={{ type: 'timing', duration: 300 }} onTransitionEnd={({ finished }) => { if (finished && !visible) setMounted(false); }} > ... </EaseView> ); }
-
-
Clean up imports:
- Remove Reanimated imports that are no longer used in the file
- Keep any Reanimated imports still referenced by non-migrated code in the same file
- Never remove imports that are still used
-
Print progress:
[1/N] Migrated ComponentName in path/to/file.tsx
Safety Rules
These rules are non-negotiable. Violating them corrupts user code.
- 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"
- 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.
- Preserve all non-animation logic. Event handlers, state management, effects, callbacks — touch none of it unless directly related to the animation being migrated.
- Preserve component structure and public API. Props, ref forwarding, exported types — keep them identical.
- 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.
- Map rotation units correctly. Reanimated string → EaseView
'45deg'number. If the source uses radians, convert:45.radians * (180 / Math.PI) - Map easing presets correctly. See the mapping table in Phase 2.
- 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.
Phase 6: Final Report
After all migrations are applied, print:
## Migration Complete
### Changed (X components)
- `path/to/file.tsx` — ComponentName: brief description of what was migrated
### Unchanged (Y components)
- `path/to/file.tsx` — ComponentName: reason skipped
### Next Steps
- Run your app and verify animations visually
- Run your test suite to check for regressions
- If no Reanimated code remains, consider removing `react-native-reanimated` from dependenciesEaseView API Reference (for migration accuracy)
Supported Animatable Properties
All properties in the prop:
animate| Property | Type | Default | Notes |
|---|---|---|---|
| | | 0–1 range |
| | | In DIPs (density-independent pixels) |
| | | In DIPs |
| | | Shorthand for scaleX + scaleY |
| | | Overrides scale for X axis |
| | | Overrides scale for Y axis |
| | | Z-axis rotation in degrees |
| | | X-axis rotation in degrees (3D) |
| | | Y-axis rotation in degrees (3D) |
| | | In pixels |
| | | Any RN color value |
Transition Types
Timing:
typescript
transition={{
type: 'timing',
duration: 300, // ms, default 300
easing: 'easeInOut', // 'linear' | 'easeIn' | 'easeOut' | 'easeInOut' | [x1,y1,x2,y2]
loop: 'repeat', // 'repeat' | 'reverse' — requires initialAnimate
}}Spring:
typescript
transition={{
type: 'spring',
damping: 15, // default 15
stiffness: 120, // default 120
mass: 1, // default 1
}}None (instant):
typescript
transition={{ type: 'none' }}Key Props
- — target values for animated properties
animate - — starting values (animates to
initialAnimateon mount)animate - — animation config (timing or spring)
transition - — callback with
onTransitionEnd{ finished: boolean } - — pivot point as
transformOrigin, default center{ x: 0-1, y: 0-1 } - — Android GPU optimization (boolean, default false)
useHardwareLayer
Important Constraints
- Loop requires timing (not spring) and must define the start value
initialAnimate - No per-property transitions — one transition config applies to all animated properties
- No animation sequencing — no equivalent to /
withSequencewithDelay - No gesture/scroll-driven animations — EaseView is state-driven only
- Style/animate conflict — if a property appears in both and
style, the animated value winsanimate