From cf0a6e9e2734a5927b9dc08303c22477ad274150 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Fri, 30 Apr 2021 17:39:43 -0700 Subject: [PATCH] Refactor RCTMultilineTextInputNativeComponent to use NativeComponentRegistry instead of requireNativeComponent Summary: This diff migrates RCTMultilineTextInputNativeComponent to use NativeComponentRegistry instead of requireNativeComponent. The intention is to unify the way the component is registered and enable StaticViewConfigs for this component changelog: [internal] internal Reviewed By: JoshuaGross Differential Revision: D28116333 fbshipit-source-id: b245026ebcd564380d0c74bbd6d9a36c661a8e71 --- .../RCTMultilineTextInputNativeComponent.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js b/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js index 18662d32933f80..51e79f707e8d64 100644 --- a/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +++ b/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js @@ -9,11 +9,10 @@ */ import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes'; -import requireNativeComponent from '../../ReactNative/requireNativeComponent'; import codegenNativeCommands from '../../Utilities/codegenNativeCommands'; import type {TextInputNativeCommands} from './TextInputNativeCommands'; import RCTTextInputViewConfig from './RCTTextInputViewConfig'; -import ReactNativeViewConfigRegistry from '../../Renderer/shims/ReactNativeViewConfigRegistry'; +import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry'; type NativeType = HostComponent; @@ -23,17 +22,10 @@ export const Commands: NativeCommands = codegenNativeCommands({ supportedCommands: ['focus', 'blur', 'setTextAndSelection'], }); -let MultilineTextInputNativeComponent; -if (global.RN$Bridgeless) { - ReactNativeViewConfigRegistry.register('RCTMultilineTextInputView', () => { - return RCTTextInputViewConfig; - }); - MultilineTextInputNativeComponent = 'RCTMultilineTextInputView'; -} else { - MultilineTextInputNativeComponent = requireNativeComponent( - 'RCTMultilineTextInputView', - ); -} +const MultilineTextInputNativeComponent: HostComponent = NativeComponentRegistry.get( + 'RCTMultilineTextInputView', + () => RCTTextInputViewConfig, +); // flowlint-next-line unclear-type:off export default ((MultilineTextInputNativeComponent: any): HostComponent);