Render ordinary elements that move to a destination, respond to gestures and depart gracefully.
Animated.<tag>
Animated.div, Animated.button, Animated.svg and every other HTML or SVG tag render the ordinary element with no wrapper. Their style accepts values, and transforms can be arrays as in React Native.
Finite transform and opacity motion on these elements, including springs, is eligible for browser playback.
Preparing the example…
seed, pose, poses and tempo
seed is the first frame, pose the current destination (an object or the name of an entry in poses), and tempo a timing or spring. Changing tempo alone does not replay an unchanged destination.
respond maps gestures to temporary destinations: hover, focus, focusWithin, press, longPress, drag, inView and more. When a response ends, the element returns to its pose from wherever it is.
onResponse reports each edge, and respond={{ press: {} }} observes a gesture without changing anything visually.
Preparing the example…
Share defaults with Animated.Scope
Animated.Scope passes a pose name, tempo and animation defaults to the Animated elements inside it.
Animated.wrap(Component) — createAnimatedComponent in React Native — makes a ref-forwarding component that resolves to one DOM element accept the same props.