diff --git a/Libraries/Components/View/ReactNativeViewAttributes.js b/Libraries/Components/View/ReactNativeViewAttributes.js index 7dee20801a..22e53b438a 100644 --- a/Libraries/Components/View/ReactNativeViewAttributes.js +++ b/Libraries/Components/View/ReactNativeViewAttributes.js @@ -48,7 +48,6 @@ const UIView = { validKeysDown: true, validKeysUp: true, draggedTypes: true, - nextKeyViewTag: true, // macOS] }; diff --git a/Libraries/Components/View/ReactNativeViewViewConfigMacOS.js b/Libraries/Components/View/ReactNativeViewViewConfigMacOS.js index 267db8ca88..f8c179edb5 100644 --- a/Libraries/Components/View/ReactNativeViewViewConfigMacOS.js +++ b/Libraries/Components/View/ReactNativeViewViewConfigMacOS.js @@ -39,7 +39,6 @@ const ReactNativeViewViewConfigMacOS = { accessibilityTraits: true, draggedTypes: true, enableFocusRing: true, - nextKeyViewTag: true, onBlur: true, onClick: true, onDoubleClick: true, diff --git a/Libraries/Components/View/ViewPropTypes.js b/Libraries/Components/View/ViewPropTypes.js index 6261064885..445d4587a1 100644 --- a/Libraries/Components/View/ViewPropTypes.js +++ b/Libraries/Components/View/ViewPropTypes.js @@ -438,13 +438,6 @@ type MacOSViewProps = $ReadOnly<{| */ acceptsFirstMouse?: ?boolean, - /** - * The react tag of the view that follows the current view in the key view loop. - * - * @platform macos - */ - nextKeyViewTag?: ?number, - /** * Specifies whether focus ring should be drawn when the view has the first responder status. * diff --git a/Libraries/NativeComponent/PlatformBaseViewConfig.js b/Libraries/NativeComponent/PlatformBaseViewConfig.js index 07c84a8679..f2721ab464 100644 --- a/Libraries/NativeComponent/PlatformBaseViewConfig.js +++ b/Libraries/NativeComponent/PlatformBaseViewConfig.js @@ -509,7 +509,6 @@ const PlatformBaseViewConfig: PartialViewConfigWithoutName = cursor: true, draggedTypes: true, enableFocusRing: true, - nextKeyViewTag: true, tooltip: true, validKeysDown: true, validKeysUp: true, diff --git a/React/Views/RCTViewManager.m b/React/Views/RCTViewManager.m index 8f276d1297..03059eb839 100644 --- a/React/Views/RCTViewManager.m +++ b/React/Views/RCTViewManager.m @@ -14,7 +14,6 @@ #import "RCTConvert.h" #import "RCTLog.h" #import "RCTShadowView.h" -#import "RCTSinglelineTextInputView.h" // [macOS] #import "RCTUIManager.h" #import "RCTUIManagerUtils.h" #import "RCTUtils.h" @@ -498,36 +497,6 @@ RCT_EXPORT_VIEW_PROPERTY(onKeyDown, RCTDirectEventBlock) // macOS keyboard event RCT_EXPORT_VIEW_PROPERTY(onKeyUp, RCTDirectEventBlock) // macOS keyboard events RCT_EXPORT_VIEW_PROPERTY(validKeysDown, NSArray) RCT_EXPORT_VIEW_PROPERTY(validKeysUp, NSArray) -RCT_CUSTOM_VIEW_PROPERTY(nextKeyViewTag, NSNumber, RCTView) -{ - NSNumber *nextKeyViewTag = [RCTConvert NSNumber:json]; - - RCTUIManager *uiManager = [[self bridge] uiManager]; - NSView *nextKeyView = [uiManager viewForReactTag:nextKeyViewTag]; - if (nextKeyView) { - NSView *targetView = view; - // The TextInput component is implemented as a RCTUITextField wrapped by a RCTSinglelineTextInputView, - // so we need to get the first subview to properly transfer focus - if ([targetView isKindOfClass:[RCTSinglelineTextInputView class]]) { - targetView = [[view subviews] firstObject]; - } - if ([nextKeyView isKindOfClass:[RCTSinglelineTextInputView class]]) { - nextKeyView = [[nextKeyView subviews] firstObject]; - } - [targetView setNextKeyView:nextKeyView]; - } -} - -RCT_EXPORT_METHOD(recalculateKeyViewLoop: (nonnull NSNumber *)reactTag) -{ - [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { - RCTUIView *view = viewRegistry[reactTag]; - if (!view) { - RCTLogError(@"Cannot find NativeView with tag #%@", reactTag); - } - [[view window] recalculateKeyViewLoop]; - }]; -} #endif // macOS] #pragma mark - ShadowView properties diff --git a/packages/rn-tester/js/examples/KeyViewLoopExample/KeyViewLoopExample.js b/packages/rn-tester/js/examples/KeyViewLoopExample/KeyViewLoopExample.js deleted file mode 100644 index c636bbed9f..0000000000 --- a/packages/rn-tester/js/examples/KeyViewLoopExample/KeyViewLoopExample.js +++ /dev/null @@ -1,153 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; // [macOS] - -const React = require('react'); -const ReactNative = require('react-native'); -import {Platform} from 'react-native'; -const {Text, View, Button, TextInput, StyleSheet, findNodeHandle} = ReactNative; - -class KeyViewLoopExample extends React.Component<{}> { - firstViewRef = React.createRef(); - secondViewRef = React.createRef(); - thirdViewRef = React.createRef(); - fourthViewRef = React.createRef(); - - render() { - return ( - - - Key-view loops allow custom control of keyboard accessibility to - navigate between controls. - - - {Platform.OS === 'macos' ? ( - - { - this.firstViewRef.current?.setNativeProps({ - nextKeyViewTag: findNodeHandle(this.secondViewRef.current), - }); - }}> - First View - - { - this.thirdViewRef.current?.setNativeProps({ - nextKeyViewTag: findNodeHandle(this.fourthViewRef.current), - }); - }}> - Third View - - { - this.secondViewRef.current?.setNativeProps({ - nextKeyViewTag: findNodeHandle(this.thirdViewRef.current), - }); - }}> - Second View - -