Add a hand-written JS view config for RCTSinglelineTextInputView
Summary: `requireNativeComponent` redboxes in bridgeless mode because there is no UIManager. This adds a handwritten view config to avoid using UIManager. Reviewed By: ejanzer Differential Revision: D19624044 fbshipit-source-id: 5ae68f63068a131a305754003154ee0cf0f1be46
This commit is contained in:
Родитель
9ae95582e7
Коммит
e1b8c954ef
|
@ -15,6 +15,8 @@ import requireNativeComponent from '../../ReactNative/requireNativeComponent';
|
|||
import codegenNativeCommands from '../../Utilities/codegenNativeCommands';
|
||||
import type {Int32} from '../../Types/CodegenTypes';
|
||||
import * as React from 'react';
|
||||
import RCTSinglelineTextInputViewConfig from './RCTSinglelineTextInputViewConfig';
|
||||
const ReactNativeViewConfigRegistry = require('../../Renderer/shims/ReactNativeViewConfigRegistry');
|
||||
|
||||
type NativeType = HostComponent<mixed>;
|
||||
|
||||
|
@ -43,8 +45,17 @@ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|||
],
|
||||
});
|
||||
|
||||
const SinglelineTextInputNativeComponent: HostComponent<mixed> = requireNativeComponent<mixed>(
|
||||
'RCTSinglelineTextInputView',
|
||||
);
|
||||
let SinglelineTextInputNativeComponent;
|
||||
if (global.RN$Bridgeless) {
|
||||
ReactNativeViewConfigRegistry.register('RCTSinglelineTextInputView', () => {
|
||||
return RCTSinglelineTextInputViewConfig;
|
||||
});
|
||||
SinglelineTextInputNativeComponent = 'RCTSinglelineTextInputView';
|
||||
} else {
|
||||
SinglelineTextInputNativeComponent = requireNativeComponent<mixed>(
|
||||
'RCTSinglelineTextInputView',
|
||||
);
|
||||
}
|
||||
|
||||
export default SinglelineTextInputNativeComponent;
|
||||
// flowlint-next-line unclear-type:off
|
||||
export default ((SinglelineTextInputNativeComponent: any): HostComponent<mixed>);
|
||||
|
|
|
@ -0,0 +1,134 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import ReactNativeViewViewConfig from '../../Components/View/ReactNativeViewViewConfig';
|
||||
import type {ReactNativeBaseComponentViewConfig} from '../../Renderer/shims/ReactNativeTypes';
|
||||
|
||||
const RCTSinglelineTextInputViewConfig = {
|
||||
uiViewClassName: 'RCTSinglelineTextInputView',
|
||||
bubblingEventTypes: {
|
||||
topBlur: {
|
||||
phasedRegistrationNames: {
|
||||
bubbled: 'onBlur',
|
||||
captured: 'onBlurCapture',
|
||||
},
|
||||
},
|
||||
topChange: {
|
||||
phasedRegistrationNames: {
|
||||
bubbled: 'onChange',
|
||||
captured: 'onChangeCapture',
|
||||
},
|
||||
},
|
||||
topEndEditing: {
|
||||
phasedRegistrationNames: {
|
||||
bubbled: 'onEndEditing',
|
||||
captured: 'onEndEditingCapture',
|
||||
},
|
||||
},
|
||||
topFocus: {
|
||||
phasedRegistrationNames: {
|
||||
bubbled: 'onFocus',
|
||||
captured: 'onFocusCapture',
|
||||
},
|
||||
},
|
||||
topKeyPress: {
|
||||
phasedRegistrationNames: {
|
||||
bubbled: 'onKeyPress',
|
||||
captured: 'onKeyPressCapture',
|
||||
},
|
||||
},
|
||||
topSubmitEditing: {
|
||||
phasedRegistrationNames: {
|
||||
bubbled: 'onSubmitEditing',
|
||||
captured: 'onSubmitEditingCapture',
|
||||
},
|
||||
},
|
||||
topTouchCancel: {
|
||||
phasedRegistrationNames: {
|
||||
bubbled: 'onTouchCancel',
|
||||
captured: 'onTouchCancelCapture',
|
||||
},
|
||||
},
|
||||
topTouchEnd: {
|
||||
phasedRegistrationNames: {
|
||||
bubbled: 'onTouchEnd',
|
||||
captured: 'onTouchEndCapture',
|
||||
},
|
||||
},
|
||||
|
||||
topTouchMove: {
|
||||
phasedRegistrationNames: {
|
||||
bubbled: 'onTouchMove',
|
||||
captured: 'onTouchMoveCapture',
|
||||
},
|
||||
},
|
||||
},
|
||||
directEventTypes: {},
|
||||
validAttributes: {
|
||||
...ReactNativeViewViewConfig.validAttributes,
|
||||
fontSize: true,
|
||||
fontWeight: true,
|
||||
fontVariant: true,
|
||||
// flowlint-next-line untyped-import:off
|
||||
textShadowOffset: {diff: require('../../Utilities/differ/sizesDiffer')},
|
||||
allowFontScaling: true,
|
||||
fontStyle: true,
|
||||
textTransform: true,
|
||||
textAlign: true,
|
||||
fontFamily: true,
|
||||
lineHeight: true,
|
||||
isHighlighted: true,
|
||||
writingDirection: true,
|
||||
textDecorationLine: true,
|
||||
textShadowRadius: true,
|
||||
letterSpacing: true,
|
||||
textDecorationStyle: true,
|
||||
textDecorationColor: {process: require('../../StyleSheet/processColor')},
|
||||
color: {process: require('../../StyleSheet/processColor')},
|
||||
maxFontSizeMultiplier: true,
|
||||
textShadowColor: {process: require('../../StyleSheet/processColor')},
|
||||
editable: true,
|
||||
inputAccessoryViewID: true,
|
||||
caretHidden: true,
|
||||
enablesReturnKeyAutomatically: true,
|
||||
placeholderTextColor: {process: require('../../StyleSheet/processColor')},
|
||||
onSelectionChange: true,
|
||||
clearButtonMode: true,
|
||||
onContentSizeChange: true,
|
||||
keyboardType: true,
|
||||
selection: true,
|
||||
returnKeyType: true,
|
||||
blurOnSubmit: true,
|
||||
mostRecentEventCount: true,
|
||||
onChange: true,
|
||||
scrollEnabled: true,
|
||||
selectionColor: {process: require('../../StyleSheet/processColor')},
|
||||
contextMenuHidden: true,
|
||||
secureTextEntry: true,
|
||||
onTextInput: true,
|
||||
placeholder: true,
|
||||
autoCorrect: true,
|
||||
onScroll: true,
|
||||
multiline: true,
|
||||
textContentType: true,
|
||||
maxLength: true,
|
||||
autoCapitalize: true,
|
||||
keyboardAppearance: true,
|
||||
passwordRules: true,
|
||||
spellCheck: true,
|
||||
selectTextOnFocus: true,
|
||||
text: true,
|
||||
clearTextOnFocus: true,
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = (RCTSinglelineTextInputViewConfig: ReactNativeBaseComponentViewConfig<>);
|
Загрузка…
Ссылка в новой задаче