about summary refs log tree commit diff
path: root/src/components/Dialog/types.ts
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-02-28 20:06:26 -0600
committerGitHub <noreply@github.com>2024-02-28 20:06:26 -0600
commit2440975bd224e4c39b633b21c461cb8b8d3c1f9b (patch)
tree8acfba6fec870808c36853d6005a53ed12542456 /src/components/Dialog/types.ts
parent7fd13cacfea4e9e4609ac2cfa11749544fc2f8f8 (diff)
downloadvoidsky-2440975bd224e4c39b633b21c461cb8b8d3c1f9b.tar.zst
Integrate new dialogs into old back handling (#3023)
Diffstat (limited to 'src/components/Dialog/types.ts')
-rw-r--r--src/components/Dialog/types.ts19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/components/Dialog/types.ts b/src/components/Dialog/types.ts
index 161c03734..78dfedf5a 100644
--- a/src/components/Dialog/types.ts
+++ b/src/components/Dialog/types.ts
@@ -6,11 +6,24 @@ import {ViewStyleProp} from '#/alf'
 
 type A11yProps = Required<AccessibilityProps>
 
-export type DialogControlProps = {
+/**
+ * Mutated by useImperativeHandle to provide a public API for controlling the
+ * dialog. The methods here will actually become the handlers defined within
+ * the `Dialog.Outer` component.
+ */
+export type DialogControlRefProps = {
   open: (options?: DialogControlOpenOptions) => void
   close: (callback?: () => void) => void
 }
 
+/**
+ * The return type of the useDialogControl hook.
+ */
+export type DialogControlProps = DialogControlRefProps & {
+  id: string
+  ref: React.RefObject<DialogControlRefProps>
+}
+
 export type DialogContextProps = {
   close: DialogControlProps['close']
 }
@@ -26,9 +39,7 @@ export type DialogControlOpenOptions = {
 }
 
 export type DialogOuterProps = {
-  control: {
-    ref: React.RefObject<DialogControlProps>
-  } & DialogControlProps
+  control: DialogControlProps
   onClose?: () => void
   nativeOptions?: {
     sheet?: Omit<BottomSheetProps, 'children'>