Shared Element Overview
Shared elements create visual continuity by animating a component from one screen to another. The source element bounds are measured, then animated to match the destination element’s position and size.Boundary Components
Use explicit boundary components to define shared element source and destination:Transition.Boundary.View
An animated view that can serve as a shared element destination:Transition.Boundary.Pressable
A pressable boundary that captures source bounds when tapped:Transition.Boundary.Target
Register arbitrary elements as animation targets:Accessing Bounds in Interpolators
Use thebounds() function in your screenStyleInterpolator to query shared element data:
Bounds Result
Thebounds() function returns an object with:
| Property | Type | Description |
|---|---|---|
x | number | Horizontal position |
y | number | Vertical position |
width | number | Element width |
height | number | Element height |
scale | number | Scale factor between source and destination |
transform | object | Transform matrices (translate, scale) |
Full Bounds Example
Navigation Zoom (NEW in 3.4)
Animate a shared element from its source to fullscreen with optimized transforms:- Transform that expands the element to fill the screen
- Aspect ratio preservation
- Smooth interpolation of scale and translation
Advanced Bounds Options
When callingbounds(), pass an options object:
Method Options
| Method | Purpose |
|---|---|
"transform" | Use GPU transforms for animation (default, best performance) |
"size" | Animate layout size changes |
"content" | Animate content reflow |
Scale Mode
| Mode | Behavior |
|---|---|
"match" | Match source and destination scales exactly (default) |
"none" | No scaling, only translation |
"uniform" | Scale uniformly on both axes |
Groups (NEW in 3.4)
Organize shared elements into groups for complex flows:Getting Bounds Without Animation
Access bounds without triggering animation:Deferred Animation with Bounds
Return"defer" to wait for bounds to be measured:
Creating Boundary Components (NEW in 3.4)
Wrap custom components with boundary functionality:alreadyAnimated?: boolean- Set true if component already applies animations
Deprecated sharedBoundTag
ThesharedBoundTag prop is deprecated. Migrate to boundary components:
Masked View Setup (Deprecated)
Transition.MaskedView is deprecated. Use navigationMaskEnabled instead:
navigationMaskEnabled (NEW in 3.4)
Automatically applies masking for shared element reveal effects:Shared Elements with Gestures
Combine shared elements with interactive gestures:Multiple Shared Elements
Animate multiple elements simultaneously:Troubleshooting Shared Elements
Bounds Not Measuring
Ensure boundary components are rendered:Animation Jumps
Use"defer" to wait for measurement:
Bounds Mismatch
Ensure source and destination have matching IDs:Next Steps
- Master custom animations for advanced bounds usage
- Explore gesture coordination to make shared elements interactive
- See masked view setup for legacy masking patterns
