diff --git a/src/components/Dialog/context.ts b/src/components/Dialog/context.ts index bee26d0788..2ecf5ba618 100644 --- a/src/components/Dialog/context.ts +++ b/src/components/Dialog/context.ts @@ -22,7 +22,6 @@ export const Context = createContext({ disableDrag: false, setDisableDrag: () => {}, isWithinDialog: false, - preventDismiss: false, }) export function useDialogContext() { diff --git a/src/components/Dialog/index.tsx b/src/components/Dialog/index.tsx index f868fbf31f..4795385eec 100644 --- a/src/components/Dialog/index.tsx +++ b/src/components/Dialog/index.tsx @@ -54,7 +54,6 @@ export function Outer({ control, onClose, nativeOptions, - preventDismiss, testID, }: React.PropsWithChildren) { const themeName = useThemeName() @@ -166,7 +165,6 @@ export function Outer({ cornerRadius={20} backgroundColor={t.atoms.bg.backgroundColor} {...nativeOptions} - preventDismiss={preventDismiss ?? nativeOptions?.preventDismiss} onSnapPointChange={onSnapPointChange} onStateChange={onStateChange} disableDrag={disableDrag}> diff --git a/src/components/Dialog/index.web.tsx b/src/components/Dialog/index.web.tsx index 3f0bb878cf..12bd8819b1 100644 --- a/src/components/Dialog/index.web.tsx +++ b/src/components/Dialog/index.web.tsx @@ -40,7 +40,6 @@ export function Outer({ control, onClose, webOptions, - preventDismiss, }: React.PropsWithChildren) { const {_} = useLingui() const {gtMobile} = useBreakpoints() @@ -53,9 +52,7 @@ export function Outer({ }, [setIsOpen, setDialogIsOpen, control.id]) const close = React.useCallback( - (cb, force) => { - if (preventDismiss && !force) return - + cb => { setDialogIsOpen(control.id, false) setIsOpen(false) @@ -75,7 +72,7 @@ export function Outer({ onClose?.() }, - [control.id, onClose, setDialogIsOpen, preventDismiss], + [control.id, onClose, setDialogIsOpen], ) const handleBackgroundPress = React.useCallback(async () => { @@ -99,9 +96,8 @@ export function Outer({ disableDrag: false, setDisableDrag: () => {}, isWithinDialog: true, - preventDismiss: preventDismiss ?? false, }), - [close, preventDismiss], + [close], ) return ( @@ -243,10 +239,7 @@ export const InnerFlatList = React.forwardRef< export function Close() { const {_} = useLingui() - const {close, preventDismiss} = React.useContext(Context) - - if (preventDismiss) return null - + const {close} = React.useContext(Context) return ( , ) => void - close: (callback?: () => void, force?: boolean) => void + close: (callback?: () => void) => void } /** @@ -46,7 +46,6 @@ export type DialogContextProps = { setDisableDrag: React.Dispatch> // in the event that the hook is used outside of a dialog isWithinDialog: boolean - preventDismiss: boolean } export type DialogControlOpenOptions = { @@ -63,7 +62,6 @@ export type DialogOuterProps = { control: DialogControlProps onClose?: () => void nativeOptions?: Omit - preventDismiss?: boolean webOptions?: { alignCenter?: boolean }