Documentation

API Reference

Public exports, parsed result, capabilities, and diagnostics for motionwind-react-native v2.

React Native API reference

Public exports

import {
  mw,
  MotionwindProvider,
  useMotionwindConfig,
  useMotionwind,
  useInView,
  parseMotionClasses,
  clearParserCache,
  reactNativeAdapter,
  REACT_NATIVE_CAPABILITIES,
  MotionwindVariantContext,
  useVariantContext,
  MotionwindScrollContext,
  useMotionScrollContext,
  defineConfig,
  definePreset,
  defineMotionwindPlugin,
  MOTIONWIND_RECIPES,
} from "motionwind-react-native";

The package also exports MotionwindConfig, MotionwindDiagnostic, and all native parsed-result types.

Provider

<MotionwindProvider config={config}>{children}</MotionwindProvider>

The provider supplies tokens, presets, plugins, strictness, and reduced-motion policy to runtime parsing. With reducedMotion: "always", or with the system preference under the default "user" policy, interactive handlers are omitted and target values are applied without animation.

ParsedResult

interface ParsedResult {
  nativewindClasses: string;
  gestures: Partial<Record<GestureKey, NativeAnimatableStyle>>;
  transition: TransitionConfig;
  viewport: ViewportConfig;
  dragConfig: DragConfig;
  scroll: ScrollConfig;
  variants: VariantMap;
  variantState: VariantState;
  hasMotion: boolean;
  diagnostics: MotionwindDiagnostic[];
}

TransitionConfig uses milliseconds and Reanimated easing names. ScrollConfig contains { axis, container, offset, values }, with values mapped to native property names. Variants map names to NativeAnimatableStyle; variantState selects initial, active, and exit names.

viewport and DragConfig remain public compatibility types, but the v2 component adapter does not orchestrate in-view or drag. Unsupported drag syntax returns an empty dragConfig plus a diagnostic.

Capabilities

const REACT_NATIVE_CAPABILITIES = {
  gestures: true,
  scroll: true,
  layout: false,
  drag: false,
  variants: true,
  svg: false,
  "reduced-motion": true,
} as const;

gestures: true describes the supported native handler subset; it does not promote in-view orchestration or drag. Use diagnostics for a class-level decision.

Native diagnostic codes

CodeMeaningRequired action
unsupported-native-inviewanimate-inview:* is not consumed.Measure/observe visibility and orchestrate directly.
unsupported-native-dragDrag classes have no native recognizer.Use Gesture Handler and Reanimated.
unsupported-native-layoutLayout projection classes are not consumed.Use Reanimated layout transitions.
unsupported-native-propertyThe class targets CSS, SVG, perspective, or another web-only value.Use a native component/API with an explicit implementation.

Shared parser diagnostics can also appear for unknown classes, invalid values, missing presets, or extension compatibility.

Subpath exports

Advanced integrations may import motionwind-react-native/parser, /config, or /adapter. The package also exposes /babel for compatibility with tooling; applications should configure Reanimated using the installation guide rather than treating that subpath as a replacement for Reanimated's plugin.