Revert dialog updates
This commit is contained in:
@@ -22,7 +22,6 @@ export const Context = createContext<DialogContextProps>({
|
||||
disableDrag: false,
|
||||
setDisableDrag: () => {},
|
||||
isWithinDialog: false,
|
||||
preventDismiss: false,
|
||||
})
|
||||
|
||||
export function useDialogContext() {
|
||||
|
||||
@@ -54,7 +54,6 @@ export function Outer({
|
||||
control,
|
||||
onClose,
|
||||
nativeOptions,
|
||||
preventDismiss,
|
||||
testID,
|
||||
}: React.PropsWithChildren<DialogOuterProps>) {
|
||||
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}>
|
||||
|
||||
@@ -40,7 +40,6 @@ export function Outer({
|
||||
control,
|
||||
onClose,
|
||||
webOptions,
|
||||
preventDismiss,
|
||||
}: React.PropsWithChildren<DialogOuterProps>) {
|
||||
const {_} = useLingui()
|
||||
const {gtMobile} = useBreakpoints()
|
||||
@@ -53,9 +52,7 @@ export function Outer({
|
||||
}, [setIsOpen, setDialogIsOpen, control.id])
|
||||
|
||||
const close = React.useCallback<DialogControlProps['close']>(
|
||||
(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 (
|
||||
<View
|
||||
style={[
|
||||
|
||||
@@ -26,7 +26,7 @@ export type DialogControlRefProps = {
|
||||
open: (
|
||||
options?: DialogControlOpenOptions & Partial<GestureResponderEvent>,
|
||||
) => void
|
||||
close: (callback?: () => void, force?: boolean) => void
|
||||
close: (callback?: () => void) => void
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,6 @@ export type DialogContextProps = {
|
||||
setDisableDrag: React.Dispatch<React.SetStateAction<boolean>>
|
||||
// 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<BottomSheetViewProps, 'children'>
|
||||
preventDismiss?: boolean
|
||||
webOptions?: {
|
||||
alignCenter?: boolean
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user