diff --git a/package.json b/package.json index 1709d495e1..e32100ece8 100644 --- a/package.json +++ b/package.json @@ -172,7 +172,7 @@ "react-native-compressor": "^1.8.24", "react-native-date-picker": "^4.4.2", "react-native-drawer-layout": "^4.0.0-alpha.3", - "react-native-gesture-handler": "^2.20.0", + "react-native-gesture-handler": "2.20.0", "react-native-get-random-values": "~1.11.0", "react-native-image-crop-picker": "0.41.2", "react-native-ios-context-menu": "^1.15.3", diff --git a/src/components/Menu/index.tsx b/src/components/Menu/index.tsx index 052b56af89..16b1690c88 100644 --- a/src/components/Menu/index.tsx +++ b/src/components/Menu/index.tsx @@ -1,6 +1,6 @@ import React from 'react' import {StyleProp, View, ViewStyle} from 'react-native' -import {} from 'react-native-gesture-handler' +import {BlueskyBottomSheetPressable as Pressable} from '@haileyok/bluesky-bottom-sheet' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import flattenReactChildren from 'react-keyed-flatten-children' @@ -103,7 +103,7 @@ export function Outer({ export function Item({children, label, style, onPress, ...rest}: ItemProps) { const t = useTheme() const {control} = React.useContext(Context) - const {state: focused, onIn: onFocus, onOut: onBlur} = useInteractionState() + const {state: focused} = useInteractionState() const { state: pressed, onIn: onPressIn, @@ -116,14 +116,11 @@ export function Item({children, label, style, onPress, ...rest}: ItemProps) { accessibilityHint="" accessibilityLabel={label} onPress={e => { + control?.close() onPress(e) - - if (!e.defaultPrevented) { - control?.close() - } }} - onFocus={onFocus} - onBlur={onBlur} + // onFocus={onFocus} + // onBlur={onBlur} onPressIn={e => { onPressIn() rest.onPressIn?.(e) diff --git a/src/components/Menu/types.ts b/src/components/Menu/types.ts index 2f7aea5de5..e5d1d16a8d 100644 --- a/src/components/Menu/types.ts +++ b/src/components/Menu/types.ts @@ -4,6 +4,8 @@ import { GestureResponderEvent, PressableProps, } from 'react-native' +import {PressableEvent} from 'react-native-gesture-handler/lib/typescript/components/Pressable/PressableProps' +import {BueskyBottomSheetPressableProps} from '@haileyok/bluesky-bottom-sheet' import {TextStyleProp, ViewStyleProp} from '#/alf' import * as Dialog from '#/components/Dialog' @@ -87,10 +89,10 @@ export type TriggerChildProps = } export type ItemProps = React.PropsWithChildren< - Omit & + Omit & ViewStyleProp & { label: string - onPress: (e: GestureResponderEvent) => void + onPress: (e: PressableEvent | GestureResponderEvent) => void } > diff --git a/yarn.lock b/yarn.lock index e1594a4cdb..d20d4a4cdc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18068,7 +18068,7 @@ react-native-drawer-layout@^4.0.0-alpha.3: dependencies: use-latest-callback "^0.1.9" -react-native-gesture-handler@^2.20.0: +react-native-gesture-handler@2.20.0: version "2.20.0" resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-2.20.0.tgz#2d9ec4e9bd22619ebe36269dda3ecb1173928276" integrity sha512-rFKqgHRfxQ7uSAivk8vxCiW4SB3G0U7jnv7kZD4Y90K5kp6YrU8Q3tWhxe3Rx55BIvSd3mBe9ZWbWVJ0FsSHPA==