diff options
author | Hailey <me@haileyok.com> | 2024-02-06 12:51:32 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-06 12:51:32 -0800 |
commit | 52f57b3aec04435a82f488e027bd8c1efe25c2bb (patch) | |
tree | 093e8f52467d934200ca6aaeee5fc596525939bf /src/view/com/util/forms/Button.tsx | |
parent | 9ccad0ba6c4d0730c3adfaa4b1e469445c7ea77f (diff) | |
download | voidsky-52f57b3aec04435a82f488e027bd8c1efe25c2bb.tar.zst |
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
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], |