Keep leaving children until their motion ends, and animate position and size changes, including across components.
Animated.Keep
Animated.Keep retains keyed direct children through their depart pose. seed={false} makes children present on the first render start at their pose, wait delays entering children until departures finish, and onDeparted fires after the last one.
Preparing the example…
Animated.Scene and move
Animated.Scene measures the committed layout. An element with move animates changes in its position and size; a string such as move="pill" connects elements with the same identity inside the Scene, even when one unmounts and another mounts.
Scene owns the layout translate and scale of those elements, so put your own transforms on a nested element.
Preparing the example…
Presence with a hook
useAnimatedPresence(visible, { enter, exit }) returns { mounted, animatedValue } when you prefer to control mounting yourself.
createLayoutScene gives the same capture/commit coordination to any renderer or manual DOM change.
outside-react.js
const scene = createLayoutScene({ tempo: { spring: { stiffness: 320, damping: 30 } } });
const card = scene.attach(element, { key: 'card' });
scene.capture(); // before the DOM changes
list.prepend(element); // any renderer or manual DOM work
scene.commit(); // animates from the captured rectangles