Revert dialog updates

This commit is contained in:
Eric Bailey
2025-08-05 11:59:01 -05:00
parent c877626db6
commit 4dc45f40ad
4 changed files with 5 additions and 17 deletions
-1
View File
@@ -22,7 +22,6 @@ export const Context = createContext<DialogContextProps>({
disableDrag: false,
setDisableDrag: () => {},
isWithinDialog: false,
preventDismiss: false,
})
export function useDialogContext() {
-2
View File
@@ -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}>
+4 -11
View File
@@ -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={[
+1 -3
View File
@@ -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
}