SwipeUI
DocsTheming & motion

Motion

Five feels, ten roles and interruptible springs that respect Reduce Motion.

Variant
Preset
Material
Scheme
Feel
Real free component with a browser animation bridge. Native motion, haptics and materials need a device.

Motion describes a job, and a feel describes its character. Feels are smooth, snappy, springy, bouncy and none. The ten roles are press, toggle, select, morph, layout, overlay, drag, list, number and ambient.

app/_layout.tsx
import { MotionProvider } from '@/components/swipeui/lib/motion';

<MotionProvider feel="springy">
  <App />
</MotionProvider>

<Button motion="snappy">Save</Button>

A ThemeProvider inherits the preset's feel unless motion is explicit. Interactive controls and JavaScript tab bars accept a local motion override, including { feel, spring: { duration, dampingRatio }, pressScale }. Static leaves leave motion to their parents. Native tab transitions and native sheets remain platform-owned; attached sheet motion follows the app feel.

Authoring an animation

components/indicator.tsx
import { useMotion } from '@/components/swipeui/lib/motion';

const motion = useMotion('select');
position.set(withSpring(target, motion.spring)); // UI-thread spring

Use spring for stateful movement, timing for timed numbers, fade for opacity and exit for shorter exits. CSS samples share the duration-based spring equations, but CSS transitions cannot carry finger release velocity. Follow a drag directly, then use the spring with its release velocity. Toggle/select springs clamp their end state even in bouncy. Selection haptics follow accepted detents; primary impacts happen on activation.

Reduce Motion

System Reduce Motion always wins. none removes travel and allows short opacity feedback. A nested provider can force reduceMotion="always" for previews; it cannot bypass system preferences. Reanimated's system snapshot is read at startup, so restart the app when comparing device settings. Native APIs also receive system reduction settings.

Development lab

The showcase /motion-lab compares all roles across all feels. Development-only timeScale={2} and {4} preview 0.5× and 0.25×. Ambient examples are manually triggered, with no background loops. Number examples run on the UI thread. On-device feel tuning remains pending.

Provider API

PropTypeDefaultDescription
childrenReactNode—
feel?MotionFeel'smooth'

Character inherited by animated items.

reduceMotion?"always" | "system"'system'

System preferences cannot be bypassed.

timeScale?number1

Multiplier for durations in development only; 4 means quarter speed.

Accessibility

  • System Reduce Motion and forced previews remove travel; no provider option bypasses the system preference.

Motion

  • Uses the press, toggle, select, morph, layout, overlay, drag, list, number and ambient motion roles, so it follows your app's feel. Pass motion to tune this one instance.
  • Uses shared role springs and inherited or local motion settings; system Reduce Motion removes travel. Native device tuning remains pending.
  • Ambient timing now has feel-owned loop periods; consumers do not multiply component-local durations.

Performance

  • Native animations run on the UI thread; custom CSS sample curves are computed only when hook inputs change.

Notes for AI

  • Read spring for withSpring, timing for withTiming and css for CSS transitions. CSS transitions cannot preserve release velocity.

Compatibility

Runs onSupported
Expo SDK 57Yes
Expo SDK 58Yes
React Native CLI (with Expo modules)Yes
Expo GoYes
iOSYes
AndroidYes

This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.

Related items

On this page