diff --git a/src/BottomSheetBackdrop.tsx b/src/BottomSheetBackdrop.tsx index a0a1bfc..788ce97 100644 --- a/src/BottomSheetBackdrop.tsx +++ b/src/BottomSheetBackdrop.tsx @@ -5,7 +5,6 @@ import Animated, { useAnimatedStyle, } from 'react-native-reanimated'; import { getAnimatedIndex } from './animatedRegistry'; -import { useSheetStatus } from './bottomSheet.store'; interface BottomSheetBackdropProps { sheetId: string; @@ -16,9 +15,7 @@ export function BottomSheetBackdrop({ sheetId, onPress, }: BottomSheetBackdropProps) { - const status = useSheetStatus(sheetId); const animatedIndex = getAnimatedIndex(sheetId); - const isInteractive = status === 'open'; const animatedStyle = useAnimatedStyle(() => { const opacity = interpolate( @@ -35,9 +32,7 @@ export function BottomSheetBackdrop({ { - if (isInteractive) { - onPress?.(); - } + onPress?.(); }} > , id: string, diff --git a/src/store/store.ts b/src/store/store.ts index fbce896..4076235 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -7,6 +7,7 @@ import { getTopSheetId, isActivatableKeepMounted, isHidden, + isOpening, removeFromStack, updateSheet, } from './helpers'; @@ -66,7 +67,7 @@ export const useBottomSheetStore = create( startClosing: (id) => set((state) => { const sheet = state.sheetsById[id]; - if (!sheet || isHidden(sheet)) return state; + if (!sheet || isHidden(sheet) || isOpening(sheet)) return state; let updatedSheetsById = updateSheet(state.sheetsById, id, { status: 'closing',