From cb3321e3b05e632ff986d47cc982ec66c892d450 Mon Sep 17 00:00:00 2001 From: Ramanpreet Nara Date: Tue, 11 Jan 2022 00:23:24 -0800 Subject: [PATCH] Refactor: Inline AndroidTextInputViewConfig Summary: Putting the static view config into its own file creates the uncertainty that n > 1 files import the static view config. This isn't true for AndroidTextViewConfig. So, let's just inline this static view config in the NativeComponent that uses it. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D33341776 fbshipit-source-id: 6fb710b8776d7b9276022c5226acefd7cf8395fb --- .../AndroidTextInputNativeComponent.js | 103 +++++++++++++++++- 1 file changed, 101 insertions(+), 2 deletions(-) diff --git a/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js b/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js index 20b386cac4e..1d03d433e6f 100644 --- a/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +++ b/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js @@ -25,7 +25,6 @@ import type { } from '../../StyleSheet/StyleSheet'; import codegenNativeCommands from '../../Utilities/codegenNativeCommands'; import type {TextInputNativeCommands} from './TextInputNativeCommands'; -import AndroidTextInputViewConfig from './AndroidTextInputViewConfig'; import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry'; export type KeyboardType = @@ -596,7 +595,107 @@ export const Commands: NativeCommands = codegenNativeCommands({ let AndroidTextInputNativeComponent = NativeComponentRegistry.get( 'AndroidTextInput', - () => AndroidTextInputViewConfig, + () => ({ + uiViewClassName: 'AndroidTextInput', + bubblingEventTypes: { + topBlur: { + phasedRegistrationNames: { + bubbled: 'onBlur', + captured: 'onBlurCapture', + }, + }, + topEndEditing: { + phasedRegistrationNames: { + bubbled: 'onEndEditing', + captured: 'onEndEditingCapture', + }, + }, + topFocus: { + phasedRegistrationNames: { + bubbled: 'onFocus', + captured: 'onFocusCapture', + }, + }, + topKeyPress: { + phasedRegistrationNames: { + bubbled: 'onKeyPress', + captured: 'onKeyPressCapture', + }, + }, + topSubmitEditing: { + phasedRegistrationNames: { + bubbled: 'onSubmitEditing', + captured: 'onSubmitEditingCapture', + }, + }, + topTextInput: { + phasedRegistrationNames: { + bubbled: 'onTextInput', + captured: 'onTextInputCapture', + }, + }, + }, + directEventTypes: {}, + validAttributes: { + maxFontSizeMultiplier: true, + adjustsFontSizeToFit: true, + minimumFontScale: true, + autoFocus: true, + placeholder: true, + inlineImagePadding: true, + contextMenuHidden: true, + textShadowColor: {process: require('../../StyleSheet/processColor')}, + maxLength: true, + selectTextOnFocus: true, + textShadowRadius: true, + underlineColorAndroid: { + process: require('../../StyleSheet/processColor'), + }, + textDecorationLine: true, + blurOnSubmit: true, + textAlignVertical: true, + fontStyle: true, + textShadowOffset: true, + selectionColor: {process: require('../../StyleSheet/processColor')}, + selection: true, + placeholderTextColor: {process: require('../../StyleSheet/processColor')}, + importantForAutofill: true, + lineHeight: true, + textTransform: true, + returnKeyType: true, + keyboardType: true, + multiline: true, + color: {process: require('../../StyleSheet/processColor')}, + autoCompleteType: true, + autoComplete: true, + numberOfLines: true, + letterSpacing: true, + returnKeyLabel: true, + fontSize: true, + onKeyPress: true, + cursorColor: {process: require('../../StyleSheet/processColor')}, + text: true, + showSoftInputOnFocus: true, + textAlign: true, + autoCapitalize: true, + autoCorrect: true, + caretHidden: true, + secureTextEntry: true, + textBreakStrategy: true, + onScroll: true, + onContentSizeChange: true, + disableFullscreenUI: true, + includeFontPadding: true, + fontWeight: true, + fontFamily: true, + allowFontScaling: true, + onSelectionChange: true, + mostRecentEventCount: true, + inlineImageLeft: true, + editable: true, + fontVariant: true, + }, + }), ); // flowlint-next-line unclear-type:off