Skip to content

Commit 067bcb5

Browse files
RSNarafacebook-github-bot
authored andcommitted
Fix SVC for RCT{Multiline,Singleline}TextInput
Summary: See title. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D33341775 fbshipit-source-id: be1c876375b1106d51e871805c23d345906b4631
1 parent 9022849 commit 067bcb5

File tree

4 files changed

+43
-129
lines changed

4 files changed

+43
-129
lines changed

Libraries/Components/TextInput/AndroidTextInputViewConfig.js

Lines changed: 0 additions & 113 deletions
This file was deleted.

Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,14 @@ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
2323
});
2424

2525
const MultilineTextInputNativeComponent: HostComponent<mixed> =
26-
NativeComponentRegistry.get<mixed>(
27-
'RCTMultilineTextInputView',
28-
() => RCTTextInputViewConfig,
29-
);
26+
NativeComponentRegistry.get<mixed>('RCTMultilineTextInputView', () => ({
27+
uiViewClassName: 'RCTMultilineTextInputView',
28+
...RCTTextInputViewConfig,
29+
validAttributes: {
30+
...RCTTextInputViewConfig.validAttributes,
31+
dataDetectorTypes: true,
32+
},
33+
}));
3034

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

Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
2323
});
2424

2525
const SinglelineTextInputNativeComponent: HostComponent<mixed> =
26-
NativeComponentRegistry.get<mixed>(
27-
'RCTSinglelineTextInputView',
28-
() => RCTTextInputViewConfig,
29-
);
26+
NativeComponentRegistry.get<mixed>('RCTSinglelineTextInputView', () => ({
27+
uiViewClassName: 'RCTSinglelineTextInputView',
28+
...RCTTextInputViewConfig,
29+
}));
3030

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

Libraries/Components/TextInput/RCTTextInputViewConfig.js

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@
1010

1111
import type {PartialViewConfig} from '../../Renderer/shims/ReactNativeTypes';
1212

13+
type PartialViewConfigWithoutName = $Rest<
14+
PartialViewConfig,
15+
{uiViewClassName: string},
16+
>;
17+
1318
const RCTTextInputViewConfig = {
14-
uiViewClassName: 'RCTSinglelineTextInputView',
1519
bubblingEventTypes: {
1620
topBlur: {
1721
phasedRegistrationNames: {
@@ -25,6 +29,12 @@ const RCTTextInputViewConfig = {
2529
captured: 'onChangeCapture',
2630
},
2731
},
32+
topContentSizeChange: {
33+
phasedRegistrationNames: {
34+
captured: 'onContentSizeChangeCapture',
35+
bubbled: 'onContentSizeChange',
36+
},
37+
},
2838
topEndEditing: {
2939
phasedRegistrationNames: {
3040
bubbled: 'onEndEditing',
@@ -69,7 +79,23 @@ const RCTTextInputViewConfig = {
6979
},
7080
},
7181
},
72-
directEventTypes: {},
82+
directEventTypes: {
83+
topTextInput: {
84+
registrationName: 'onTextInput',
85+
},
86+
topKeyPressSync: {
87+
registrationName: 'onKeyPressSync',
88+
},
89+
topScroll: {
90+
registrationName: 'onScroll',
91+
},
92+
topSelectionChange: {
93+
registrationName: 'onSelectionChange',
94+
},
95+
topChangeSync: {
96+
registrationName: 'onChangeSync',
97+
},
98+
},
7399
validAttributes: {
74100
fontSize: true,
75101
fontWeight: true,
@@ -97,23 +123,18 @@ const RCTTextInputViewConfig = {
97123
caretHidden: true,
98124
enablesReturnKeyAutomatically: true,
99125
placeholderTextColor: {process: require('../../StyleSheet/processColor')},
100-
onSelectionChange: true,
101126
clearButtonMode: true,
102-
onContentSizeChange: true,
103127
keyboardType: true,
104128
selection: true,
105129
returnKeyType: true,
106130
blurOnSubmit: true,
107131
mostRecentEventCount: true,
108-
onChange: true,
109132
scrollEnabled: true,
110133
selectionColor: {process: require('../../StyleSheet/processColor')},
111134
contextMenuHidden: true,
112135
secureTextEntry: true,
113-
onTextInput: true,
114136
placeholder: true,
115137
autoCorrect: true,
116-
onScroll: true,
117138
multiline: true,
118139
textContentType: true,
119140
maxLength: true,
@@ -124,7 +145,9 @@ const RCTTextInputViewConfig = {
124145
selectTextOnFocus: true,
125146
text: true,
126147
clearTextOnFocus: true,
148+
showSoftInputOnFocus: true,
149+
autoFocus: true,
127150
},
128151
};
129152

130-
module.exports = (RCTTextInputViewConfig: PartialViewConfig);
153+
module.exports = (RCTTextInputViewConfig: PartialViewConfigWithoutName);

0 commit comments

Comments
 (0)