mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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:
committed by
Facebook GitHub Bot
parent
e68cf7cee9
commit
4cdafd997a
@@ -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>);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
'use strict';
|
||||
|
||||
import ReactNativeViewViewConfig from '../../Components/View/ReactNativeViewViewConfig';
|
||||
import {type ViewConfig} from '../../Renderer/shims/ReactNativeTypes';
|
||||
import {type PartialViewConfig} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
|
||||
|
||||
const AndroidTextInputViewConfig = {
|
||||
uiViewClassName: 'AndroidTextInput',
|
||||
@@ -58,6 +58,9 @@ const AndroidTextInputViewConfig = {
|
||||
...ReactNativeViewViewConfig.validAttributes,
|
||||
|
||||
maxFontSizeMultiplier: true,
|
||||
adjustsFontSizeToFit: true,
|
||||
minimumFontScale: true,
|
||||
autoFocus: true,
|
||||
placeholder: true,
|
||||
inlineImagePadding: true,
|
||||
contextMenuHidden: true,
|
||||
@@ -80,7 +83,7 @@ const AndroidTextInputViewConfig = {
|
||||
returnKeyType: true,
|
||||
keyboardType: true,
|
||||
multiline: true,
|
||||
color: true,
|
||||
color: {process: require('../../StyleSheet/processColor')},
|
||||
autoCompleteType: true,
|
||||
numberOfLines: true,
|
||||
letterSpacing: true,
|
||||
@@ -111,4 +114,4 @@ const AndroidTextInputViewConfig = {
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = (AndroidTextInputViewConfig: ViewConfig);
|
||||
module.exports = (AndroidTextInputViewConfig: PartialViewConfig);
|
||||
|
||||
Reference in New Issue
Block a user