Skip to content

Commit

Permalink
Refactor RCTMultilineTextInputNativeComponent to use NativeComponentR…
Browse files Browse the repository at this point in the history
…egistry 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
  • Loading branch information
mdvacca authored and facebook-github-bot committed May 1, 2021
1 parent f76943a commit cf0a6e9
Showing 1 changed file with 5 additions and 13 deletions.
Expand Up @@ -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<mixed>;

Expand All @@ -23,17 +22,10 @@ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['focus', 'blur', 'setTextAndSelection'],
});

let MultilineTextInputNativeComponent;
if (global.RN$Bridgeless) {
ReactNativeViewConfigRegistry.register('RCTMultilineTextInputView', () => {
return RCTTextInputViewConfig;
});
MultilineTextInputNativeComponent = 'RCTMultilineTextInputView';
} else {
MultilineTextInputNativeComponent = requireNativeComponent<mixed>(
'RCTMultilineTextInputView',
);
}
const MultilineTextInputNativeComponent: HostComponent<mixed> = NativeComponentRegistry.get<mixed>(
'RCTMultilineTextInputView',
() => RCTTextInputViewConfig,
);

// flowlint-next-line unclear-type:off
export default ((MultilineTextInputNativeComponent: any): HostComponent<mixed>);

0 comments on commit cf0a6e9

Please sign in to comment.