Skip to main content

Hooks

Hooks are divided into two categories based on where they can be used:

HookWhere to usePurpose
useBottomSheetManagerAnywhereOpen/close sheets imperatively
useBottomSheetControlAnywhereControl portal-based sheets
useBottomSheetStatusAnywhereSubscribe to sheet status by ID
useBottomSheetContextInside sheet onlyAccess current sheet's state and params

useBottomSheetManager

Main hook for opening and managing bottom sheets imperatively.

const { open, close, clear } = useBottomSheetManager();

Returns

PropertyTypeDescription
open(content, options?) => stringOpens a bottom sheet and returns its ID
close(id: string) => voidCloses a specific sheet by ID
clear() => voidCloses all sheets in the current group

open Options

open(<MySheet />, {
id: 'my-sheet-id', // Custom ID (optional)
groupId: 'my-group', // Custom group (optional)
mode: 'push', // 'push' | 'switch' | 'replace'
scaleBackground: true, // Enable scale animation
});
OptionTypeDefaultDescription
idstringrandomCustom sheet ID
groupIdstringcontext or 'default'Group ID for the sheet
modeOpenMode'push'Navigation mode
scaleBackgroundbooleanfalseEnable background scaling

Deprecated Aliases

DeprecatedUse Instead
openBottomSheetopen
clearAllclear

useBottomSheetContext

Access the current sheet's state, params, and close function.

Inside Sheet Only

This hook can only be used inside a BottomSheetManaged component. It reads from React context - no ID parameter needed.

// Basic usage
const { id, params, close } = useBottomSheetContext();

// With typed params (for portal sheets)
const { params, close } = useBottomSheetContext<'my-sheet'>();

Generic Parameter

Pass the portal sheet ID as a generic to get typed params:

// If registry defines: 'user-sheet': { userId: string }
const { params } = useBottomSheetContext<'user-sheet'>();
console.log(params.userId); // type-safe: string

Returns

PropertyTypeDescription
idstringCurrent sheet's ID
paramsBottomSheetPortalParams<T> or unknownType-safe params when generic provided
close() => voidCloses this sheet

Deprecated Aliases

DeprecatedUse Instead
useBottomSheetStateuseBottomSheetContext
closeBottomSheetclose

useBottomSheetControl

Control portal-based sheets from anywhere in your app. Pass the sheet ID to identify which sheet to control.

No Re-renders

Returns only methods - no state subscriptions. Use useBottomSheetStatus separately if you need to react to status changes.

const { open, close, updateParams, resetParams } = useBottomSheetControl('my-sheet');

Parameters

ParameterTypeDescription
idBottomSheetPortalIdThe portal sheet ID to control

Returns

PropertyTypeDescription
open(options?) => voidOpens the sheet
close() => voidCloses the sheet
updateParams(params) => voidUpdates the sheet's params
resetParams() => voidResets params to undefined

open Options

// Sheet without params (registry: 'simple-sheet': true)
open();
open({ scaleBackground: true });

// Sheet with params (registry: 'user-sheet': { userId: string })
open({
mode: 'push',
scaleBackground: true,
params: { userId: '123' } // Required when params defined in registry
});
OptionTypeDefaultDescription
modeOpenMode'push'Navigation mode
scaleBackgroundbooleanfalseEnable background scaling
paramsBottomSheetPortalParams<T>-Type-safe params

useBottomSheetStatus

Subscribe to any sheet's status from anywhere in your app. Pass the sheet ID to identify which sheet to observe.

When to Use

Use this when you need to show UI based on whether a sheet is open, or react to status changes. Separate from useBottomSheetControl to avoid unnecessary re-renders in components that only need to trigger sheets.

const { status, isOpen } = useBottomSheetStatus('my-sheet');

Parameters

ParameterTypeDescription
idBottomSheetPortalIdThe sheet ID to observe

Returns

PropertyTypeDescription
statusBottomSheetStatus | nullCurrent status or null if never opened
isOpenbooleantrue if status is 'open' or 'opening'

Status Values

StatusDescription
'opening'Sheet is animating open
'open'Sheet is fully open
'closing'Sheet is animating closed
'hidden'Sheet is hidden (switch mode)
nullSheet has not been opened

Example: Separating Control and Status

function MyComponent() {
// No re-renders from this hook
const { open, close } = useBottomSheetControl('my-sheet');

return <Button onPress={() => open()} title="Open" />;
}

function StatusIndicator() {
// Only this component re-renders on status changes
const { isOpen } = useBottomSheetStatus('my-sheet');

return <Text>{isOpen ? 'Sheet is open' : 'Sheet is closed'}</Text>;
}