From 52f57b3aec04435a82f488e027bd8c1efe25c2bb Mon Sep 17 00:00:00 2001 From: Hailey Date: Tue, 6 Feb 2024 12:51:32 -0800 Subject: Display the language selection dialog correctly on web (#2719) * add event to callback * position translation button correctly based on press position * properly place the background * remove worthless comment --- src/view/com/util/forms/Button.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/view/com/util/forms/Button.tsx') 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 - | GestureResponderEvent - export type ButtonType = | 'primary' | 'secondary' @@ -59,7 +57,7 @@ export function Button({ style?: StyleProp labelContainerStyle?: StyleProp labelStyle?: StyleProp - onPress?: () => void | Promise + onPress?: (e: NativeSyntheticEvent) => void | Promise 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], -- cgit 1.4.1