-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Sheets] [Pt. 4] Convert Pressable in Menu (WIP) #5562
Changes from all commits
801cb62
a17892d
3971254
64f849b
6dec099
d0149a9
40030ba
0b55acd
368a9df
a4c7e2f
e1ccacc
32bb8cb
7c09a94
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import React from 'react' | ||
import {Pressable, StyleProp, View, ViewStyle} from 'react-native' | ||
import {StyleProp, View, ViewStyle} from 'react-native' | ||
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' | ||
|
@@ -102,7 +103,11 @@ 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, | ||
onIn: onHoverIn, | ||
onOut: onHoverOut, | ||
} = useInteractionState() | ||
const { | ||
state: pressed, | ||
onIn: onPressIn, | ||
|
@@ -115,14 +120,9 @@ export function Item({children, label, style, onPress, ...rest}: ItemProps) { | |
accessibilityHint="" | ||
accessibilityLabel={label} | ||
onPress={e => { | ||
control?.close() | ||
onPress(e) | ||
|
||
if (!e.defaultPrevented) { | ||
control?.close() | ||
} | ||
Comment on lines
-120
to
-122
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's wrong with this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm cleaning these up in a second PR actually, good catch here. Let me get back to you once I do that (and just pick the change back down to here so its clear) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reverted in this PR, not picking because types are still borked in this PR (didn't normalize the pressables yet) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see any usages of this, but I may have missed one. We have the same functionality in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea I added it back in the commit linked above. Just wasn't typed correctly at this stage in the refactor. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I hadn't refreshed the page, was replying to your prev 👍 |
||
}} | ||
onFocus={onFocus} | ||
onBlur={onBlur} | ||
onPressIn={e => { | ||
onPressIn() | ||
rest.onPressIn?.(e) | ||
|
@@ -131,6 +131,8 @@ export function Item({children, label, style, onPress, ...rest}: ItemProps) { | |
onPressOut() | ||
rest.onPressOut?.(e) | ||
}} | ||
onHoverIn={onHoverIn} | ||
onHoverOut={onHoverOut} | ||
style={[ | ||
a.flex_row, | ||
a.align_center, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4120,10 +4120,10 @@ | |
resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.2.0.tgz#5f3d96ec6b2354ad6d8a28bf216a1d97b5426861" | ||
integrity sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ== | ||
|
||
"@haileyok/bluesky-bottom-sheet@^0.1.1-alpha.7": | ||
version "0.1.1-alpha.7" | ||
resolved "https://registry.yarnpkg.com/@haileyok/bluesky-bottom-sheet/-/bluesky-bottom-sheet-0.1.1-alpha.7.tgz#a5845cd2ac386b78716db5940b65b3e78b392042" | ||
integrity sha512-Ps2nsNmfjqUmP/LPAM94/2dWZerwZEjnvSUfi/ipFNHlNp/McIYIObxDaPJaZ0ZLxUcRXxdhmC3UonK25sJKSw== | ||
"@haileyok/bluesky-bottom-sheet@^0.1.1-alpha.8": | ||
version "0.1.1-alpha.8" | ||
resolved "https://registry.yarnpkg.com/@haileyok/bluesky-bottom-sheet/-/bluesky-bottom-sheet-0.1.1-alpha.8.tgz#c5fd503cdd5556a686a1f5c0974b1527fceda900" | ||
integrity sha512-305MSNscniLZpxd80QO4OCuMXkm+U/v/YW/x0fVQtBilVTikOOPIkiYge+kCUdryFPD3LU/GdrsQZL+y8qAiMQ== | ||
|
||
"@haileyok/[email protected]": | ||
version "0.1.10" | ||
|
@@ -18068,15 +18068,14 @@ react-native-drawer-layout@^4.0.0-alpha.3: | |
dependencies: | ||
use-latest-callback "^0.1.9" | ||
|
||
react-native-gesture-handler@~2.16.2: | ||
version "2.16.2" | ||
resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-2.16.2.tgz#032bd2a07334292d7f6cff1dc9d1ec928f72e26d" | ||
integrity sha512-vGFlrDKlmyI+BT+FemqVxmvO7nqxU33cgXVsn6IKAFishvlG3oV2Ds67D5nPkHMea8T+s1IcuMm0bF8ntZtAyg== | ||
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== | ||
dependencies: | ||
"@egjs/hammerjs" "^2.0.17" | ||
hoist-non-react-statics "^3.3.0" | ||
invariant "^2.2.4" | ||
lodash "^4.17.21" | ||
prop-types "^15.7.2" | ||
|
||
react-native-get-random-values@^1.6.0: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is it hover now instead of focus?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as comment below 👍