Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/QueueItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { PortalHost } from 'react-native-teleport';
import { cleanupAnimatedIndex, getAnimatedIndex } from './animatedRegistry';
import { BottomSheetContext } from './BottomSheet.context';
import {
useSheetBackdrop,
useSheetContent,
useSheetKeepMounted,
useSheetPortalSession,
Expand All @@ -32,6 +33,7 @@ export const QueueItem = memo(function QueueItem({
const usePortal = useSheetUsePortal(id);
const keepMounted = useSheetKeepMounted(id);
const portalSession = useSheetPortalSession(id);
const backdrop = useSheetBackdrop(id);

const { width, height } = useSafeAreaFrame();

Expand All @@ -56,7 +58,7 @@ export const QueueItem = memo(function QueueItem({

return (
<>
{isActive && (
{isActive && backdrop !== false && (
<View
style={[StyleSheet.absoluteFillObject, { zIndex: backdropZIndex }]}
pointerEvents="box-none"
Expand Down
4 changes: 4 additions & 0 deletions src/store/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export const useSheetUsePortal = (id: string) =>

export const useSheetKeepMounted = (id: string) =>
useBottomSheetStore((state) => state.sheetsById[id]?.keepMounted, shallow);

export const useSheetBackdrop = (id: string) =>
useBottomSheetStore((state) => state.sheetsById[id]?.backdrop, shallow);

export const useSheetPortalSession = (id: string) =>
useBottomSheetStore((state) => state.sheetsById[id]?.portalSession, shallow);
export const useSheetPreventDismiss = (id: string) =>
Expand Down
1 change: 1 addition & 0 deletions src/store/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const useBottomSheetStore = create(
status: 'opening',
scaleBackground:
sheet.scaleBackground ?? existingSheet.scaleBackground,
backdrop: sheet.backdrop ?? existingSheet.backdrop,
params: sheet.params ?? existingSheet.params,
portalSession: existingSheet.keepMounted
? existingSheet.portalSession
Expand Down
1 change: 1 addition & 0 deletions src/store/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface BottomSheetState {
content?: ReactNode;
status: BottomSheetStatus;
scaleBackground?: boolean;
backdrop?: boolean;
usePortal?: boolean;
params?: Record<string, unknown>;
keepMounted?: boolean;
Expand Down
2 changes: 2 additions & 0 deletions src/useBottomSheetControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import type { CloseAllOptions } from './useBottomSheetManager';
interface BaseOpenOptions<TParams> {
mode?: OpenMode;
scaleBackground?: boolean;
backdrop?: boolean;
params?: TParams;
}

Expand Down Expand Up @@ -64,6 +65,7 @@ export function useBottomSheetControl<T extends BottomSheetPortalId>(
content: null,
usePortal: true,
scaleBackground: options?.scaleBackground,
backdrop: options?.backdrop,
params: options?.params as Record<string, unknown>,
},
options?.mode
Expand Down
2 changes: 2 additions & 0 deletions src/useBottomSheetManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const useBottomSheetManager = () => {
groupId?: string;
mode?: OpenMode;
scaleBackground?: boolean;
backdrop?: boolean;
} = {}
) => {
const groupId =
Expand All @@ -44,6 +45,7 @@ export const useBottomSheetManager = () => {
groupId,
content: contentWithRef,
scaleBackground: options.scaleBackground,
backdrop: options.backdrop,
},
options.mode
);
Expand Down