Documentation

Hooks

Use useMotionwind and the limited useInView helper for custom native orchestration.

Hooks

useMotionwind(className)

The hook parses with provider configuration and returns:

const {
  animatedStyle,
  handlers,
  parsed,
  animateTo,
  resetToBase,
  variantProvide,
} = useMotionwind(className);
  • animatedStyle is passed to an Animated component.
  • handlers contains supported press, hover, and focus callbacks.
  • parsed includes diagnostics and adapted native data.
  • animateTo(style) runs a supported native target.
  • resetToBase() returns to the enter/default target.
  • variantProvide supports custom variant propagation.
const motion = useMotionwind(
  "animate-enter:opacity-100 animate-tap:scale-95 animate-duration-150",
);

<Animated.View
  style={[baseStyle, motion.animatedStyle]}
  {...motion.handlers}
/>;

useInView(config)

This helper returns { isInView, onLayout, viewRef }. It compares the layout event's local Y coordinates with the current window height. It does not observe subsequent parent scrolling and does not implement the amount threshold.

Treat it as a simple layout helper, not parity with web IntersectionObserver. For scroll-aware visibility, use the owner ScrollView's measurement or viewability API and call animateTo explicitly.

Parser cache

parseMotionClasses uses a bounded cache when no custom config is passed. clearParserCache() is available for tests and long-lived development tooling.