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

[Fabric] Add support for native key event handling #12146

Merged
merged 17 commits into from
Sep 21, 2023

Conversation

acoates-ms
Copy link
Contributor

@acoates-ms acoates-ms commented Sep 18, 2023

Description

No current infra for handling keyboard events on the native side.

Type of Change

  • New feature (non-breaking change which adds functionality)

Why

  • Parity
  • Some native components, such as scrollview will require native keyboard handling.
  • Adds ability for 3rd party components to provide custom native keyboard behavior
  • Makes Switch focusable by default
  • Implements keyboard handling for Space to toggle switch.

What

Adds props parsing for the keyUpEvents and keyDownEvents properties.
Adds a bubbling of key events on the native component tree.
Adds suppression of the key event bubbling in the case of a bubbling key*Events property specifying that it should be suppressed.
Add a method on the native ComponentView's which can be implemented by say ScrollViewer to handle key events natively (Will be useful for #12076)

Microsoft Reviewers: Open in CodeFlow

@acoates-ms acoates-ms added the Area: Fabric Support Facebook Fabric label Sep 18, 2023
@acoates-ms acoates-ms requested a review from a team as a code owner September 18, 2023 17:20
@acoates-ms acoates-ms enabled auto-merge (squash) September 18, 2023 18:16
@acoates-ms acoates-ms requested a review from a team as a code owner September 19, 2023 17:19
@acoates-ms acoates-ms merged commit ff73a56 into microsoft:main Sep 21, 2023
42 checks passed
@acoates-ms acoates-ms deleted the nativekey branch September 21, 2023 23:24
@Saadnajmi
Copy link
Contributor

I think the answer is no, but is there any of this PR that happens in common cpp I could at least copy / use as a reference for RN-macOS? I.E: the HandledKeyEvent type, etc?

@acoates-ms
Copy link
Contributor Author

The "common" code is in https://github.com/microsoft/react-native-windows/blob/main/vnext/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.cpp

-- Thats the place on the native side we should align on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Fabric Support Facebook Fabric New Architecture Broad category for issues that apply to the RN "new" architecture of Turbo Modules + Fabric
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants