Documentation

Gestures

Tap, hover, and focus gesture animations for React Native.

Gestures

Gesture-based animations respond to user interactions. On React Native, these map to native touch handlers instead of DOM events.

Gesture prefixes

Class prefixWeb eventRN handlerDescription
animate-tap:whileTaponPressIn / onPressOutWhile finger is pressing
animate-hover:whileHoveronHoverIn / onHoverOutPointer hover (RN 0.71+)
animate-focus:whileFocusonFocus / onBlurElement has focus
animate-enter:animateMount animationWhen component mounts
animate-initial:initialStarting stateBefore entrance animation
animate-exit:exitUnmount animationWhen component unmounts

Tap animations

The most common gesture on mobile. Animates while the user's finger is pressing, then reverts when released.

Scale on press

Scale on PressNative
9:41

Scale + opacity

Multi-property TapNative
9:41

Entrance + gesture combined

You can combine entrance animations with gesture animations on the same element:

Entrance + Tap CombinedNative
9:41

Staggered interactive list

Combine staggered entrance with tap gestures:

Staggered List ItemsNative
9:41

Hover animations

Note: whileHover requires React Native 0.71+ with Pointer Events enabled, or a connected mouse/trackpad. On pure touch devices, hover events don't fire.

<mw.View className="animate-hover:scale-105 animate-hover:opacity-90 animate-duration-200">
  <mw.Text>Hover with a mouse</mw.Text>
</mw.View>

Focus animations

Useful for TextInput and other focusable elements:

<mw.TextInput
  className="animate-focus:scale-102 animate-focus:border-w-2 animate-spring"
  placeholder="Focus me"
/>

Next steps