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
|
||||
// pressable so that it is usable inside the dialog.
|
||||
const dialogContext = useDialogContext()
|
||||
const {insideDialog} = useDialogContext()
|
||||
if (!Component) {
|
||||
if (dialogContext) {
|
||||
if (insideDialog) {
|
||||
Component = NormalizedRNGHPressable
|
||||
} else {
|
||||
Component = Pressable
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
|
||||
export const Context = React.createContext<DialogContextProps>({
|
||||
close: () => {},
|
||||
insideDialog: false,
|
||||
})
|
||||
|
||||
export function useDialogContext() {
|
||||
|
||||
@@ -82,7 +82,7 @@ export function Outer({
|
||||
[open, close],
|
||||
)
|
||||
|
||||
const context = React.useMemo(() => ({close}), [close])
|
||||
const context = React.useMemo(() => ({close, insideDialog: true}), [close])
|
||||
|
||||
return (
|
||||
<Portal>
|
||||
|
||||
@@ -37,6 +37,7 @@ export type DialogControlProps = DialogControlRefProps & {
|
||||
|
||||
export type DialogContextProps = {
|
||||
close: DialogControlProps['close']
|
||||
insideDialog: boolean
|
||||
}
|
||||
|
||||
export type DialogControlOpenOptions = {
|
||||
|
||||
Reference in New Issue
Block a user