about summary refs log tree commit diff
path: root/src/components/Prompt.tsx
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-06-14 14:24:04 -0500
committerGitHub <noreply@github.com>2024-06-14 14:24:04 -0500
commit5751014117ff87a0b5188841b468095f00305ed5 (patch)
treeea34cf6f99797da7dc05a561e8e5ad4fb753f11b /src/components/Prompt.tsx
parent51a3e601324b4032257e5e932a8eedc39f539975 (diff)
downloadvoidsky-5751014117ff87a0b5188841b468095f00305ed5.tar.zst
Feed source card (#4512)
* Pass event through click handlers

* Add FeedCard, use in Feeds screen

* Tweak space

* Don't contrain rt height

* Tweak space

* Fix type errors, don't pass event to fns that don't expect it

* Show unresolved RT prior to facet resolution
Diffstat (limited to 'src/components/Prompt.tsx')
-rw-r--r--src/components/Prompt.tsx17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/components/Prompt.tsx b/src/components/Prompt.tsx
index d05cab5ab..315ad0dfd 100644
--- a/src/components/Prompt.tsx
+++ b/src/components/Prompt.tsx
@@ -1,10 +1,10 @@
 import React from 'react'
-import {View} from 'react-native'
+import {GestureResponderEvent, View} from 'react-native'
 import {msg} from '@lingui/macro'
 import {useLingui} from '@lingui/react'
 
 import {atoms as a, useBreakpoints, useTheme} from '#/alf'
-import {Button, ButtonColor, ButtonText} from '#/components/Button'
+import {Button, ButtonColor, ButtonProps, ButtonText} from '#/components/Button'
 import * as Dialog from '#/components/Dialog'
 import {Text} from '#/components/Typography'
 
@@ -136,7 +136,7 @@ export function Action({
    * Note: The dialog will close automatically when the action is pressed, you
    * should NOT close the dialog as a side effect of this method.
    */
-  onPress: () => void
+  onPress: ButtonProps['onPress']
   color?: ButtonColor
   /**
    * Optional i18n string. If undefined, it will default to "Confirm".
@@ -147,9 +147,12 @@ export function Action({
   const {_} = useLingui()
   const {gtMobile} = useBreakpoints()
   const {close} = Dialog.useDialogContext()
-  const handleOnPress = React.useCallback(() => {
-    close(onPress)
-  }, [close, onPress])
+  const handleOnPress = React.useCallback(
+    (e: GestureResponderEvent) => {
+      close(() => onPress?.(e))
+    },
+    [close, onPress],
+  )
 
   return (
     <Button
@@ -186,7 +189,7 @@ export function Basic({
    * Note: The dialog will close automatically when the action is pressed, you
    * should NOT close the dialog as a side effect of this method.
    */
-  onConfirm: () => void
+  onConfirm: ButtonProps['onPress']
   confirmButtonColor?: ButtonColor
   showCancel?: boolean
 }>) {