Revert dialog updates
This commit is contained in:
@@ -22,7 +22,6 @@ export const Context = createContext<DialogContextProps>({
|
|||||||
disableDrag: false,
|
disableDrag: false,
|
||||||
setDisableDrag: () => {},
|
setDisableDrag: () => {},
|
||||||
isWithinDialog: false,
|
isWithinDialog: false,
|
||||||
preventDismiss: false,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
export function useDialogContext() {
|
export function useDialogContext() {
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ export function Outer({
|
|||||||
control,
|
control,
|
||||||
onClose,
|
onClose,
|
||||||
nativeOptions,
|
nativeOptions,
|
||||||
preventDismiss,
|
|
||||||
testID,
|
testID,
|
||||||
}: React.PropsWithChildren<DialogOuterProps>) {
|
}: React.PropsWithChildren<DialogOuterProps>) {
|
||||||
const themeName = useThemeName()
|
const themeName = useThemeName()
|
||||||
@@ -166,7 +165,6 @@ export function Outer({
|
|||||||
cornerRadius={20}
|
cornerRadius={20}
|
||||||
backgroundColor={t.atoms.bg.backgroundColor}
|
backgroundColor={t.atoms.bg.backgroundColor}
|
||||||
{...nativeOptions}
|
{...nativeOptions}
|
||||||
preventDismiss={preventDismiss ?? nativeOptions?.preventDismiss}
|
|
||||||
onSnapPointChange={onSnapPointChange}
|
onSnapPointChange={onSnapPointChange}
|
||||||
onStateChange={onStateChange}
|
onStateChange={onStateChange}
|
||||||
disableDrag={disableDrag}>
|
disableDrag={disableDrag}>
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ export function Outer({
|
|||||||
control,
|
control,
|
||||||
onClose,
|
onClose,
|
||||||
webOptions,
|
webOptions,
|
||||||
preventDismiss,
|
|
||||||
}: React.PropsWithChildren<DialogOuterProps>) {
|
}: React.PropsWithChildren<DialogOuterProps>) {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {gtMobile} = useBreakpoints()
|
const {gtMobile} = useBreakpoints()
|
||||||
@@ -53,9 +52,7 @@ export function Outer({
|
|||||||
}, [setIsOpen, setDialogIsOpen, control.id])
|
}, [setIsOpen, setDialogIsOpen, control.id])
|
||||||
|
|
||||||
const close = React.useCallback<DialogControlProps['close']>(
|
const close = React.useCallback<DialogControlProps['close']>(
|
||||||
(cb, force) => {
|
cb => {
|
||||||
if (preventDismiss && !force) return
|
|
||||||
|
|
||||||
setDialogIsOpen(control.id, false)
|
setDialogIsOpen(control.id, false)
|
||||||
setIsOpen(false)
|
setIsOpen(false)
|
||||||
|
|
||||||
@@ -75,7 +72,7 @@ export function Outer({
|
|||||||
|
|
||||||
onClose?.()
|
onClose?.()
|
||||||
},
|
},
|
||||||
[control.id, onClose, setDialogIsOpen, preventDismiss],
|
[control.id, onClose, setDialogIsOpen],
|
||||||
)
|
)
|
||||||
|
|
||||||
const handleBackgroundPress = React.useCallback(async () => {
|
const handleBackgroundPress = React.useCallback(async () => {
|
||||||
@@ -99,9 +96,8 @@ export function Outer({
|
|||||||
disableDrag: false,
|
disableDrag: false,
|
||||||
setDisableDrag: () => {},
|
setDisableDrag: () => {},
|
||||||
isWithinDialog: true,
|
isWithinDialog: true,
|
||||||
preventDismiss: preventDismiss ?? false,
|
|
||||||
}),
|
}),
|
||||||
[close, preventDismiss],
|
[close],
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -243,10 +239,7 @@ export const InnerFlatList = React.forwardRef<
|
|||||||
|
|
||||||
export function Close() {
|
export function Close() {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {close, preventDismiss} = React.useContext(Context)
|
const {close} = React.useContext(Context)
|
||||||
|
|
||||||
if (preventDismiss) return null
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export type DialogControlRefProps = {
|
|||||||
open: (
|
open: (
|
||||||
options?: DialogControlOpenOptions & Partial<GestureResponderEvent>,
|
options?: DialogControlOpenOptions & Partial<GestureResponderEvent>,
|
||||||
) => void
|
) => void
|
||||||
close: (callback?: () => void, force?: boolean) => void
|
close: (callback?: () => void) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,7 +46,6 @@ export type DialogContextProps = {
|
|||||||
setDisableDrag: React.Dispatch<React.SetStateAction<boolean>>
|
setDisableDrag: React.Dispatch<React.SetStateAction<boolean>>
|
||||||
// in the event that the hook is used outside of a dialog
|
// in the event that the hook is used outside of a dialog
|
||||||
isWithinDialog: boolean
|
isWithinDialog: boolean
|
||||||
preventDismiss: boolean
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type DialogControlOpenOptions = {
|
export type DialogControlOpenOptions = {
|
||||||
@@ -63,7 +62,6 @@ export type DialogOuterProps = {
|
|||||||
control: DialogControlProps
|
control: DialogControlProps
|
||||||
onClose?: () => void
|
onClose?: () => void
|
||||||
nativeOptions?: Omit<BottomSheetViewProps, 'children'>
|
nativeOptions?: Omit<BottomSheetViewProps, 'children'>
|
||||||
preventDismiss?: boolean
|
|
||||||
webOptions?: {
|
webOptions?: {
|
||||||
alignCenter?: boolean
|
alignCenter?: boolean
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user