Overview
TheuseScreenAnimation hook provides access to the current animation state and interpolation properties within a screen component. Use this hook to create custom animations that respond to navigation transitions, gestures, and screen state changes.
Import
Usage
Return Value
Returns aSharedValue<ScreenInterpolationProps> from Reanimated containing all interpolation properties.
ScreenInterpolationProps
Combined progress of current and next screen transitions, ranging from 0-2:
0: Screen entering1: Screen visible2: Screen exiting
Accumulated progress from the current screen’s position onwards in the stack. Ranges from 0-N where N is the number of screens above the current screen.
Animated index of the current snap point. Returns
-1 if no snap points are defined. Interpolates between indices during gestures (e.g., 1.5 = halfway between snap 1 and 2).Whether the current screen is the focused (topmost) screen in the stack.
Values for the current screen being interpolated.Properties:
progress(number): Animation progress (0 = entering, 1 = visible)closing(number): Whether screen is being dismissed (0 or 1)entering(number): Whether screen is entering (0 or 1)animating(number): Whether currently animating (0 or 1)gesture(GestureValues): Live gesture values (x, y, normalized values, drag/dismiss state)meta(Record<string, unknown>): Custom metadata from screen optionsroute(BaseStackRoute): The route object for this screen
Values for the screen that came before the current one in the navigation stack.
undefined if no previous screen exists.Values for the screen that comes after the current one in the navigation stack.
undefined if no next screen exists.The screen state that is currently driving the transition (either current or next, whichever is focused).
The screen state that is NOT driving the transition. When focused, this is the previous screen. When not focused, this is the current screen.
Layout measurements for the screen.Properties:
screen(Layout): Object containingwidthandheightof the screen container
Safe area insets from
react-native-safe-area-context. Contains top, bottom, left, and right values.Function that provides access to bounds builders for creating shared element transitions. See Shared Elements for usage.
Examples
Basic Fade Animation
Animate Based on Gesture State
Respond to Snap Points
Stack Progress Animation
Notes
All animations must be performed within
useAnimatedStyle or other Reanimated hooks since the return value is a SharedValue that runs on the UI thread.The
progress value ranges from 0-2 where:- 0 → 1: Screen entering
- 1: Screen fully visible
- 1 → 2: Screen exiting
Related
- useScreenState - Access navigation state without animation values
- Custom Animations - Learn how to create custom screen transitions
- Shared Elements - Use bounds API for shared element transitions
