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
This commit is contained in:
Hailey
2024-02-06 12:51:32 -08:00
committed by GitHub
parent 9ccad0ba6c
commit 52f57b3aec
2 changed files with 37 additions and 15 deletions
+5 -7
View File
@@ -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],