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:
@@ -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],
|
||||
|
||||
Reference in New Issue
Block a user