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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support focusable, Yellowbox on acceptsKeyboardFocus #655

Merged
merged 4 commits into from Nov 19, 2020

Conversation

NickGerleman
Copy link

@NickGerleman NickGerleman commented Nov 18, 2020

Please select one of the following

  • I am removing an existing difference between facebook/react-native and microsoft/react-native-macos 馃憤
  • I am cherry-picking a change from Facebook's react-native into microsoft/react-native-macos 馃憤
  • I am making a fix / change for the macOS implementation of react-native
  • I am making a change required for Microsoft usage of react-native

Summary

Fixes #498

This change adds support for the "focusable" property present in upstream RN, along with react-native-windows and NetUI. We need to reconcile this against the existing acceptsKeyboardFocus property. This is tricky since its usage was untyped. We follow the same strategy as react-native-windows for this.

  1. Usages of acceptsKeyboardFocus will continue to work, but will yellowbox
  2. Components will prefer to use focusable, and Touchables with slightly different semantics will prefer focusable semantics when present

acceptsKeyboardFocus will redbox in RNW 0.64 instead of yellowbox, but this change should allow xplat code to use focusable and not be effected by that.

Changelog

[macOS] [Added] - Support focusable, Yellowbox on acceptsKeyboardFocus

Test Plan

Validated setting a view to focusable is propagated, and that setting a view to acceptsKeyboardFocus works but triggers a yellowbox. More fine-grained tests for Touchable were done with the same changes in react-native-windows.

image

Microsoft Reviewers: Open in CodeFlow

Fixes microsoft#498

This change adds support for the "focusable" property present in upstream RN, along with react-native-windows and NetUI. We need to reconcile this against the existing acceptsKeyboardFocus property. This is tricky since its usage was untyped. We follow the same strategy as react-native-windows for this.

1. Usages of acceptsKeyboardFocus will continue to work, but will yellowbox
2. Components will prefer to use focusable, and Touchables with slightly different semantics will prefer focusable semantics when present

acceptsKeyboardFocus will redbox in RNW 0.64 instead of yellowbox, but this change should allow xplat code to use focusable and not be effected by that.

Validated setting a view to focusable is propagated, and that acceptsKeyboardFocus is propagated with a yellowbox.
RNTester/Podfile.lock Outdated Show resolved Hide resolved
@NickGerleman
Copy link
Author

Need to fix prettier formatting stuff. Will take a look at what's going on with the podfile lock.

Libraries/Components/Touchable/TouchableBounce.js Outdated Show resolved Hide resolved
Libraries/Components/View/View.js Outdated Show resolved Hide resolved
@NickGerleman
Copy link
Author

Need to remove focusable from the TouchableHighlight snapshot. This looks expected though, since upstream behavior (differing from aceptsKeyboardFocus) is to not set the View to be focusable without an onPress handler, with the snapshot test doesn't seem to provide.

@NickGerleman
Copy link
Author

And RCTSinglelineTextInputView snaps already had focusable it looks like 馃槃 .

React/Views/RCTViewManager.m Show resolved Hide resolved
@NickGerleman
Copy link
Author

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@NickGerleman NickGerleman merged commit 6e78874 into microsoft:master Nov 19, 2020
@alloy
Copy link
Member

alloy commented Nov 19, 2020

馃殌

@NickGerleman NickGerleman mentioned this pull request Jan 19, 2022
4 tasks
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.

Deprecate acceptsKeyboardFocus
4 participants