-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Implement Keyboarding/Gamepad Activation for Pressability #4930
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
Conversation
Fixes microsoft#4598 This change reenables touchables to be activated by keyboard/Gamepad. The implementation is mostly stolen from the previous that was used for Touchable. Like before, this doesn't participate in the input state machine, as its coupled to touch input. This means we don't get things like long-press detection, but we do still get feedback for key-in and key-out. We should do something better when we upstream keyboard behavior to do proper integration into the Pressability state machine, but this is invasive enough that we shouldn't fork this. Validated Spacebar and enter functionality with various touchables.
| const mouseEventHandlers = | ||
| Platform.OS === 'ios' || Platform.OS === 'android' | ||
| ? null | ||
| : { | ||
| onMouseEnter: (event: MouseEvent): void => { |
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.
Curious to know what's going on here. We saw MouseEvent show up in 0.62, but IIRC didn't get an understanding of why. Wondering if they're being proactive for react-native-web?
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.
I think FB uses pressablilty on web too. These events are not hooked up to anything in RN, and may be removed in the future. (It sounds like it was a bit of a mistake they ever got into RN in their current form)
| // $FlowFixMe: PressEvents don't mesh with keyboarding APIs. Keep legacy behavior of pasing KeyEvents instead | ||
| onPressOut && onPressOut(event); |
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.
This is terrible of course 😉
All options involve some level of passing garbage unless we make upstream API changes unfortunately. This method of passing garbage is simple and the same as before though.
|
Hello @NickGerleman! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
…4930) * Implement Keybpoarding/Gamepad Activation for Pressability Fixes microsoft#4598 This change reenables touchables to be activated by keyboard/Gamepad. The implementation is mostly stolen from the previous that was used for Touchable. Like before, this doesn't participate in the input state machine, as its coupled to touch input. This means we don't get things like long-press detection, but we do still get feedback for key-in and key-out. We should do something better when we upstream keyboard behavior to do proper integration into the Pressability state machine, but this is invasive enough that we shouldn't fork this. Validated Spacebar and enter functionality with various touchables. * Change files * Flow fixes * Fix typo
* Implement Keybpoarding/Gamepad Activation for Pressability Fixes #4598 This change reenables touchables to be activated by keyboard/Gamepad. The implementation is mostly stolen from the previous that was used for Touchable. Like before, this doesn't participate in the input state machine, as its coupled to touch input. This means we don't get things like long-press detection, but we do still get feedback for key-in and key-out. We should do something better when we upstream keyboard behavior to do proper integration into the Pressability state machine, but this is invasive enough that we shouldn't fork this. Validated Spacebar and enter functionality with various touchables. * Change files * Flow fixes * Fix typo
Fixes #4598
This change reenables touchables to be activated by keyboard/Gamepad. The implementation is mostly stolen from the previous that was used for Touchable. This doesn't participate in the input state machine, as its coupled to touch input. This means we don't get things like long-press detection (whether we want that is questionable), but we do still get feedback for key-in and key-out.
We should do something better when we upstream keyboard behavior to do proper integration into the Pressability state machine, but this is invasive enough that we shouldn't fork this.
Validated Spacebar and enter functionality with various touchables.
Microsoft Reviewers: Open in CodeFlow