This commit is contained in:
Hailey
2024-10-02 16:49:36 -07:00
parent 10cb87b695
commit 431f1ffe8d
4 changed files with 5 additions and 3 deletions
+2 -2
View File
@@ -124,9 +124,9 @@ export const Button = React.forwardRef<View, ButtonProps>(
) => { ) => {
// This will pick the correct default pressable to use. If we are inside a dialog, we need to use the RNGH // This will pick the correct default pressable to use. If we are inside a dialog, we need to use the RNGH
// pressable so that it is usable inside the dialog. // pressable so that it is usable inside the dialog.
const dialogContext = useDialogContext() const {insideDialog} = useDialogContext()
if (!Component) { if (!Component) {
if (dialogContext) { if (insideDialog) {
Component = NormalizedRNGHPressable Component = NormalizedRNGHPressable
} else { } else {
Component = Pressable Component = Pressable
+1
View File
@@ -9,6 +9,7 @@ import {
export const Context = React.createContext<DialogContextProps>({ export const Context = React.createContext<DialogContextProps>({
close: () => {}, close: () => {},
insideDialog: false,
}) })
export function useDialogContext() { export function useDialogContext() {
+1 -1
View File
@@ -82,7 +82,7 @@ export function Outer({
[open, close], [open, close],
) )
const context = React.useMemo(() => ({close}), [close]) const context = React.useMemo(() => ({close, insideDialog: true}), [close])
return ( return (
<Portal> <Portal>
+1
View File
@@ -37,6 +37,7 @@ export type DialogControlProps = DialogControlRefProps & {
export type DialogContextProps = { export type DialogContextProps = {
close: DialogControlProps['close'] close: DialogControlProps['close']
insideDialog: boolean
} }
export type DialogControlOpenOptions = { export type DialogControlOpenOptions = {