Skip to content

Commit

Permalink
tweak types
Browse files Browse the repository at this point in the history
  • Loading branch information
haileyok committed Oct 1, 2024
1 parent 368a9df commit a4c7e2f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
13 changes: 5 additions & 8 deletions src/components/Menu/index.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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,
Expand All @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions src/components/Menu/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -87,10 +89,10 @@ export type TriggerChildProps =
}

export type ItemProps = React.PropsWithChildren<
Omit<PressableProps, 'style'> &
Omit<BueskyBottomSheetPressableProps, 'style'> &
ViewStyleProp & {
label: string
onPress: (e: GestureResponderEvent) => void
onPress: (e: PressableEvent | GestureResponderEvent) => void
}
>

Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
[email protected]:
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==
Expand Down

0 comments on commit a4c7e2f

Please sign in to comment.