Add supoprt for Text Input view configs

Summary:
This diff adds TextInput in the list of components that support static view configs

changelog: [internal]

Reviewed By: yungsters

Differential Revision: D26040854

fbshipit-source-id: d6b5d3a78ef4657acf3f2c4ebe527ad4ca40bcb5
This commit is contained in:
David Vacca
2021-01-26 14:01:50 -08:00
committed by Facebook GitHub Bot
parent e68cf7cee9
commit 4cdafd997a
2 changed files with 11 additions and 15 deletions
@@ -26,7 +26,7 @@ import requireNativeComponent from '../../ReactNative/requireNativeComponent';
import codegenNativeCommands from '../../Utilities/codegenNativeCommands';
import type {TextInputNativeCommands} from './TextInputNativeCommands';
import AndroidTextInputViewConfig from './AndroidTextInputViewConfig';
const ReactNativeViewConfigRegistry = require('../../Renderer/shims/ReactNativeViewConfigRegistry');
import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry';
export type KeyboardType =
// Cross Platform
@@ -545,17 +545,10 @@ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['focus', 'blur', 'setTextAndSelection'],
});
let AndroidTextInputNativeComponent;
if (global.RN$Bridgeless) {
ReactNativeViewConfigRegistry.register('AndroidTextInput', () => {
return AndroidTextInputViewConfig;
});
AndroidTextInputNativeComponent = 'AndroidTextInput';
} else {
AndroidTextInputNativeComponent = requireNativeComponent<NativeProps>(
'AndroidTextInput',
);
}
let AndroidTextInputNativeComponent = NativeComponentRegistry.get<NativeProps>(
'AndroidTextInput',
() => AndroidTextInputViewConfig,
);
// flowlint-next-line unclear-type:off
export default ((AndroidTextInputNativeComponent: any): HostComponent<NativeProps>);