Surface Slots Overview
The slot-based return format separates animation concerns into distinct layers. Each slot targets a specific visual component:contentStyle/backdropStyle format and scales well for complex animations.
Content Slot
Animates the main screen content layer:Backdrop Slot
Animates a semi-transparent backdrop layer that appears behind the content:- Dimming the previous screen
- Creating depth perception
- Preventing interaction with underlying screens
Surface Slot
Animates a custom surface layer, optionally using a custom component:surfaceComponent:
StyleId Slot
Animate specific elements within the screen using thestyleId prop:
Passing Props via Slots
Each slot can pass props to its underlying component:Combined Slot Example
A complete animation using all slots:Deferred First Frames
Return"defer" to delay rendering until conditions are met:
- Shared elements need measurement before animation
- Layout dimensions aren’t yet available
- Conditional animation requires external state
Dismissal Animation (Progress 1–2)
Handle dismissal with different slot animation:- At progress 1: Fully presented
- At progress 2: Back to initial state (dismissed)
Deprecated Flat Format
The old flat return format is deprecated:Migration from Flat Format
If upgrading from v3.3 flat format:contentStyle and backdropStyle objects inside style properties within content and backdrop slots.
Custom Surface Components
Define a custom surface renderer to create unique visual effects:Empty Slots
Omit slots you don’t need:Performance Considerations
- Fewer slots = better performance: Only animate what you need
- Reuse interpolations: Cache complex calculations
- Avoid layout-dependent slots: Use fixed values when possible
- Test on low-end devices: Ensure smooth 60fps animation
Troubleshooting
Slot Not Updating
Ensure the slot name matches exactly:Props Not Applied
Props passed via slots apply to the container, not the content:Next Steps
- Explore custom animations for detailed interpolation
- Learn shared elements to combine slots with bounds
- See snap points for sheet-specific slot usage
