style.transition for ordinary style changes caused by React state when no native gesture
lifecycle is involved. Do not use it as the pressed or selected interaction contract. Wrap
interactive content in gestureDetector and use shared values when feedback is gesture-driven,
interruptible, or needs to be cancelled or awaited.
Simple transitions
Use a transition when React state changes a style value and no imperative animation control is needed.gestureDetector and shared values so the visual state follows the native gesture
lifecycle.
Shared values
Usesv or sharedValue for a mutable value that updates outside normal React render flow.
.value. Assigning a number or color updates immediately; assigning an animation handle starts an animation.
Timing animation
timing moves a value to a target over a duration using an easing curve.
Spring animation
spring is useful for physical movement and settling after a gesture.
Decay animation
withDecay continues movement from an initial velocity and can stop at bounds.
Delay, sequence, and repeat
Use composition helpers when multiple animations form one behavior.withRepeat repeats an animation directly. repeat creates a reusable factory. Create fresh handles for each run.
Keyframes
Usekeyframes for multiple stops with different values or easing per segment.
Derived values
Derived values update automatically from other reactive values and cannot be assigned directly.add and multiply combine reactive values into another derived value.
Gesture-driven animation
UsemapEvent for high-frequency event fields and settle the value with spring when the gesture ends.
Awaiting and cancelling
Use promise helpers when the next action depends on completion.runAnimation resolves with an AnimationResult. runAnimationOrThrow rejects with AnimationCompletionError when the animation does not finish naturally. Use cancelAnimation(value) when you need to stop an active animation explicitly.
Completion reasons
Callbacks and promise helpers report:completed: reached the target naturally.cancelled: stopped withcancelAnimation.replaced: another animation took over the same value.overwritten: a direct.valueassignment replaced the animation.
Best practices
- Prefer
style.transitionfor ordinary state-driven visual changes, not pressed or selected feedback that depends on a native gesture lifecycle. - Use
mapEventfor high-frequency gesture and scroll updates. - Create fresh animation handles; do not reuse them in multiple compositions.
- Cancel or invalidate async animation flows when the component unmounts.
- Animate only fields supported by
animatedProps.