Transitions
Zoom the sheet out of the button that opens it, or use a system transition.
On iOS 18+, the sheet can zoom out of the view that opened it and shrink back into it when it closes, the same transition the system uses for its own buttons and sheets.
How?
Pass a ref to the source view as transitionRef. The ref is resolved on each present(), so the view can mount after the sheet.
export const App = () => {
const buttonRef = useRef<View>(null)
const sheet = useRef<TrueSheet>(null)
return (
<>
<Pressable ref={buttonRef} onPress={() => sheet.current?.present()}>
<Text>Open</Text>
</Pressable>
<TrueSheet
ref={sheet}
transitionRef={buttonRef}
detents={['auto', 1]}
>
<View />
</TrueSheet>
</>
)
}The source must render a native view. React Native flattens a plain View that draws nothing; add collapsable={false} to keep it.
Tapping outside and swiping down both zoom the sheet back into the source. If the source is gone by then (unmounted, or dismissed with its own sheet), the sheet uses the default dismissal.
Options
transitionOptions tunes the zoom, or picks a system transition instead.
<TrueSheet
ref={sheet}
transitionRef={buttonRef}
transitionOptions={{
alignmentRect: { x: 16, y: 16, width: 200, height: 48 },
interactiveDismiss: false,
}}
/>alignmentRectlines the source view up with a frame inside the sheet while zooming, instead of the whole sheet.interactiveDismiss: falsemakes a swipe down from the lowest detent slide the sheet away like a normal sheet, instead of zooming it back into the source. From a higher detent, a drag always resizes the sheet. It does not stop the swipe from dismissing; usedismissiblefor that.typepicks'cross-dissolve','cover-vertical'or'flip-horizontal'. These don't usetransitionRef.
<TrueSheet transitionOptions={{ type: 'cross-dissolve' }} />iOS only. On Android, web, and iOS 17 and below, the props are ignored and the sheet uses its default transition.
Position Events
The zoom does not move the sheet's frame, so onPositionChange reports the resting position when the sheet appears and the off-screen position when it starts to dismiss, with no values in between. With Reanimated, animatedPosition jumps to the resting position on present and springs off-screen on dismiss.