Skip to content
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

More fixes to usePressableState #1063

Merged
merged 3 commits into from
Oct 14, 2021

Conversation

Saadnajmi
Copy link
Collaborator

Platforms Impacted

  • iOS
  • macOS
  • win32 (Office)
  • windows
  • android

Description of changes

There are two changes in this PR:

  1. Pull in the latest version of react-native-macos that includes some bug fixes with pressable (specifically [0.63] Pull in Pressable onMouseEnter/onMouseLeave changes from #855  react-native-macos#857)
  2. Undo part of Support onPress/onLongPress in usePressableState #1061 , where I had the onPress/onLongPress callbacks set the press state. This was a mistake, as only onPressIn/onPressOut should set state. With the code as it was, onPress could fire after onPressOut, set the state {pressed: true}, and our buttons would be stuck in the pressed state even though they aren't being pressed.
  3. Makes the public API of useHoverHelper take in onHoverIn/onHoverOut, while mapping it to the Pressable props onMouseEnter/onMouseLeave. This was done because RN Core doesn't actually expose onHoverIn/onHoverOut yet, which we should fix upstream. Our desktop ports (react-native-macos and react-native-windows) expose the similar props onMouseEnter/onMouseLeave, so we should map to that.

Verification

Locally switched some controls (namely button and experimental-button) to use usePressableState instead of useAsPressable and verified that the pressed state was getting set correctly.

Pull request checklist

This PR has considered (when applicable):

  • Automated Tests
  • Documentation and examples
  • Keyboard Accessibility
  • Voiceover
  • Internationalization and Right-to-left Layouts

@Saadnajmi Saadnajmi merged commit 027fbdc into microsoft:master Oct 14, 2021
@Saadnajmi Saadnajmi deleted the more-pressable-fixes branch October 14, 2021 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants