diff options
Diffstat (limited to 'src/view/com/util/forms/Button.tsx')
-rw-r--r-- | src/view/com/util/forms/Button.tsx | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/view/com/util/forms/Button.tsx b/src/view/com/util/forms/Button.tsx index 8f24f8288..e6e05bb04 100644 --- a/src/view/com/util/forms/Button.tsx +++ b/src/view/com/util/forms/Button.tsx @@ -9,15 +9,13 @@ import { PressableStateCallbackType, ActivityIndicator, View, + NativeSyntheticEvent, + NativeTouchEvent, } from 'react-native' import {Text} from '../text/Text' import {useTheme} from 'lib/ThemeContext' import {choose} from 'lib/functions' -type Event = - | React.MouseEvent<HTMLAnchorElement, MouseEvent> - | GestureResponderEvent - export type ButtonType = | 'primary' | 'secondary' @@ -59,7 +57,7 @@ export function Button({ style?: StyleProp<ViewStyle> labelContainerStyle?: StyleProp<ViewStyle> labelStyle?: StyleProp<TextStyle> - onPress?: () => void | Promise<void> + onPress?: (e: NativeSyntheticEvent<NativeTouchEvent>) => void | Promise<void> testID?: string accessibilityLabel?: string accessibilityHint?: string @@ -148,11 +146,11 @@ export function Button({ const [isLoading, setIsLoading] = React.useState(false) const onPressWrapped = React.useCallback( - async (event: Event) => { + async (event: GestureResponderEvent) => { event.stopPropagation() event.preventDefault() withLoading && setIsLoading(true) - await onPress?.() + await onPress?.(event) withLoading && setIsLoading(false) }, [onPress, withLoading], |