Documentation

API Reference

Complete type definitions and exports for motionwind-react-native.

API Reference

Complete reference for all exports from motionwind-react-native.

Exports

import {
  // Component proxy
  mw,

  // Hooks
  useMotionwind,
  useInView,

  // Parser
  parseMotionClasses,
  clearParserCache,

  // Types
  type ParsedResult,
  type GestureKey,
  type AnimatableValues,
  type NativeAnimatableStyle,
  type TransitionConfig,
  type ViewportConfig,
  type DragConfig,
} from "motionwind-react-native";

Types

GestureKey

type GestureKey =
  | "whileHover"
  | "whileTap"
  | "whileFocus"
  | "whileInView"
  | "initial"
  | "animate"
  | "exit";

AnimatableValues

type AnimatableValues = Record<string, string | number | (string | number)[]>;

NativeAnimatableStyle

All properties that can be animated on React Native:

interface NativeAnimatableStyle {
  // Transform
  translateX?: number;
  translateY?: number;
  scale?: number;
  scaleX?: number;
  scaleY?: number;
  rotate?: string;      // "45deg"
  rotateX?: string;
  rotateY?: string;
  rotateZ?: string;
  skewX?: string;       // "15deg"
  skewY?: string;

  // Layout
  width?: number | string;
  height?: number | string;
  top?: number;
  left?: number;
  right?: number;
  bottom?: number;
  padding?: number;
  margin?: number;
  borderRadius?: number;
  borderWidth?: number;
  gap?: number;

  // Visual
  opacity?: number;
  backgroundColor?: string;
  color?: string;
  borderColor?: string;

  // Typography
  fontSize?: number;
  letterSpacing?: number;
  lineHeight?: number;
}

TransitionConfig

interface TransitionConfig {
  type?: "spring" | "timing";
  duration?: number;              // Milliseconds
  delay?: number;                 // Milliseconds
  easing?:
    | "linear" | "easeIn" | "easeOut" | "easeInOut"
    | "circIn" | "circOut" | "circInOut"
    | "backIn" | "backOut" | "backInOut"
    | number[];                   // Cubic-bezier [x1, y1, x2, y2]
  stiffness?: number;
  damping?: number;
  mass?: number;
  overshootClamping?: boolean;
  restDisplacementThreshold?: number;
  restSpeedThreshold?: number;
  repeat?: number;                // -1 for infinite
  repeatReverse?: boolean;
  staggerChildren?: number;       // Milliseconds
  staggerDirection?: 1 | -1;
  delayChildren?: number;         // Milliseconds
}

ViewportConfig

interface ViewportConfig {
  once?: boolean;
  amount?: "some" | "all" | number;  // 0–1
  margin?: number;                    // Pixels
}

DragConfig

interface DragConfig {
  drag?: boolean | "x" | "y";
  dragElastic?: number;               // 0–1
  dragSnapToOrigin?: boolean;
  dragMomentum?: boolean;
  dragConstraints?: {
    top?: number;
    left?: number;
    right?: number;
    bottom?: number;
  };
}

ParsedResult

interface ParsedResult {
  nativewindClasses: string;
  gestures: Partial<Record<GestureKey, NativeAnimatableStyle>>;
  transition: TransitionConfig;
  viewport: ViewportConfig;
  dragConfig: DragConfig;
  hasMotion: boolean;
}

Class reference

Gesture prefixes

PrefixMaps toRN Handler
animate-initial:Starting stateSet on mount
animate-enter:Target stateAnimated on mount
animate-exit:Exit stateOn unmount
animate-tap:whileTaponPressIn/Out
animate-hover:whileHoveronHoverIn/Out
animate-focus:whileFocusonFocus/Blur
animate-inview:whileInViewonLayout detection

Transition classes

ClassDescription
animate-duration-{ms}Animation duration in milliseconds
animate-delay-{ms}Delay before animation starts
animate-ease-outEase-out cubic curve
animate-ease-inEase-in cubic curve
animate-ease-in-outEase-in-out cubic curve
animate-ease-linearLinear (constant speed)
animate-ease-circ-outCircular ease-out
animate-ease-circ-inCircular ease-in
animate-ease-circ-in-outCircular ease-in-out
animate-ease-back-outBack ease-out (overshoot)
animate-ease-back-inBack ease-in
animate-ease-back-in-outBack ease-in-out
animate-ease-[x1,y1,x2,y2]Custom cubic-bezier
animate-springUse spring physics
animate-stiffness-{n}Spring stiffness
animate-damping-{n}Spring damping
animate-mass-{n}Spring mass (÷10)
animate-repeat-{n}Repeat N times
animate-repeat-infiniteLoop forever
animate-repeat-reverseReverse on repeat
animate-stagger-{ms}Stagger children delay
animate-stagger-reverseStagger from last child
animate-delay-children-{ms}Delay before first child
animate-onceAnimate only once (viewport)
animate-amount-{n}Viewport visibility %
animate-amount-allRequire full visibility
animate-margin-{n}Viewport detection offset

Drag classes

ClassDescription
animate-drag-xEnable horizontal drag
animate-drag-yEnable vertical drag
animate-drag-bothEnable both directions
animate-drag-elastic-{n}Elasticity 0–100
animate-drag-snapSnap back to origin on release
animate-drag-no-momentumStop immediately on release
animate-drag-constraint-t-{n}Max drag up (pixels)
animate-drag-constraint-b-{n}Max drag down
animate-drag-constraint-l-{n}Max drag left
animate-drag-constraint-r-{n}Max drag right

Peer dependencies

{
  "react": "^18.0.0 || ^19.0.0",
  "react-native": ">=0.72.0",
  "react-native-reanimated": "^3.0.0 || ^4.0.0",
  "nativewind": "^4.0.0 (optional)"
}