diff options
author | Minseo Lee <itoupluk427@gmail.com> | 2024-02-29 13:05:45 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-29 13:05:45 +0900 |
commit | 200c4c1d379e591e82d6d1bd065a443f6abc03f5 (patch) | |
tree | db7257f0178b2d9514642a7faf3e003d60d2b418 /src/components/Dialog/context.ts | |
parent | a1127bfcfc7ad080a5bd6210c6561788f1643db8 (diff) | |
parent | a35976cdc9b6467ad8b6e0c4ff46ba684fee9064 (diff) | |
download | voidsky-200c4c1d379e591e82d6d1bd065a443f6abc03f5.tar.zst |
Merge branch 'bluesky-social:main' into patch-3
Diffstat (limited to 'src/components/Dialog/context.ts')
-rw-r--r-- | src/components/Dialog/context.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/components/Dialog/context.ts b/src/components/Dialog/context.ts index f0c7c983a..eb717d8e2 100644 --- a/src/components/Dialog/context.ts +++ b/src/components/Dialog/context.ts @@ -3,7 +3,7 @@ import React from 'react' import {useDialogStateContext} from '#/state/dialogs' import { DialogContextProps, - DialogControlProps, + DialogControlRefProps, DialogOuterProps, } from '#/components/Dialog/types' @@ -17,7 +17,7 @@ export function useDialogContext() { export function useDialogControl(): DialogOuterProps['control'] { const id = React.useId() - const control = React.useRef<DialogControlProps>({ + const control = React.useRef<DialogControlRefProps>({ open: () => {}, close: () => {}, }) @@ -32,8 +32,13 @@ export function useDialogControl(): DialogOuterProps['control'] { }, [id, activeDialogs]) return { + id, ref: control, - open: () => control.current.open(), - close: cb => control.current.close(cb), + open: () => { + control.current.open() + }, + close: cb => { + control.current.close(cb) + }, } } |