adjust
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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() {
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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 = {
|
||||||
|
|||||||
Reference in New Issue
Block a user