@ukeyfe/react-native-text-input 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +33 -0
- package/android/build.gradle +126 -0
- package/android/generated/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/UKeyTextInputManagerDelegate.java +26 -0
- package/android/generated/android/app/build/generated/source/codegen/java/com/facebook/react/viewmanagers/UKeyTextInputManagerInterface.java +17 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/CMakeLists.txt +36 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/RNTextInputViewSpec-generated.cpp +22 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/RNTextInputViewSpec.h +24 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNTextInputViewSpec/ComponentDescriptors.cpp +22 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNTextInputViewSpec/ComponentDescriptors.h +24 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNTextInputViewSpec/EventEmitters.cpp +24 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNTextInputViewSpec/EventEmitters.h +25 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNTextInputViewSpec/Props.cpp +25 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNTextInputViewSpec/Props.h +27 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNTextInputViewSpec/RNTextInputViewSpecJSI-generated.cpp +17 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNTextInputViewSpec/RNTextInputViewSpecJSI.h +19 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNTextInputViewSpec/ShadowNodes.cpp +17 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNTextInputViewSpec/ShadowNodes.h +32 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNTextInputViewSpec/States.cpp +16 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNTextInputViewSpec/States.h +29 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/textinput/PasteWatcher.kt +10 -0
- package/android/src/main/java/com/textinput/TextInputPackage.kt +19 -0
- package/android/src/main/java/com/textinput/TextInputPasteEvent.kt +48 -0
- package/android/src/main/java/com/textinput/TextInputView.kt +80 -0
- package/android/src/main/java/com/textinput/TextInputViewManager.kt +68 -0
- package/android/src/newarch/TextInputViewManagerSpec.kt +21 -0
- package/android/src/oldarch/TextInputViewManagerSpec.kt +9 -0
- package/ios/TextInputViewManager.mm +23 -0
- package/ios/Utils.h +8 -0
- package/ios/Utils.m +26 -0
- package/ios/generated/build/generated/ios/RNTextInputViewSpec/RNTextInputViewSpec-generated.mm +16 -0
- package/ios/generated/build/generated/ios/RNTextInputViewSpec/RNTextInputViewSpec.h +38 -0
- package/ios/generated/build/generated/ios/RNTextInputViewSpecJSI-generated.cpp +17 -0
- package/ios/generated/build/generated/ios/RNTextInputViewSpecJSI.h +19 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNTextInputViewSpec/ComponentDescriptors.cpp +22 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNTextInputViewSpec/ComponentDescriptors.h +24 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNTextInputViewSpec/EventEmitters.cpp +24 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNTextInputViewSpec/EventEmitters.h +25 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNTextInputViewSpec/Props.cpp +25 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNTextInputViewSpec/Props.h +27 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNTextInputViewSpec/RCTComponentViewHelpers.h +20 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNTextInputViewSpec/ShadowNodes.cpp +17 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNTextInputViewSpec/ShadowNodes.h +32 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNTextInputViewSpec/States.cpp +16 -0
- package/ios/generated/build/generated/ios/react/renderer/components/RNTextInputViewSpec/States.h +29 -0
- package/lib/commonjs/AndroidTextInputNativeComponent.js +152 -0
- package/lib/commonjs/AndroidTextInputNativeComponent.js.map +1 -0
- package/lib/commonjs/Input.js +537 -0
- package/lib/commonjs/Input.js.map +1 -0
- package/lib/commonjs/TextInputViewNativeComponent.ts +9 -0
- package/lib/commonjs/enum.js +11 -0
- package/lib/commonjs/enum.js.map +1 -0
- package/lib/commonjs/index.js +28 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/type.js +6 -0
- package/lib/commonjs/type.js.map +1 -0
- package/lib/typescript/src/TextInputViewNativeComponent.d.ts +8 -0
- package/lib/typescript/src/TextInputViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/enum.d.ts +4 -0
- package/lib/typescript/src/enum.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +7 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/type.d.ts +16 -0
- package/lib/typescript/src/type.d.ts.map +1 -0
- package/package.json +178 -0
- package/src/AndroidTextInputNativeComponent.js +767 -0
- package/src/Input.js +1910 -0
- package/src/TextInputViewNativeComponent.ts +9 -0
- package/src/enum.ts +3 -0
- package/src/index.tsx +17 -0
- package/src/type.ts +13 -0
|
@@ -0,0 +1,767 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {HostComponent} from 'react-native/src/private/types/HostComponent';
|
|
12
|
+
import type {PartialViewConfig} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
|
|
13
|
+
import type {
|
|
14
|
+
ColorValue,
|
|
15
|
+
TextStyleProp,
|
|
16
|
+
ViewStyleProp,
|
|
17
|
+
} from 'react-native/Libraries/StyleSheet/StyleSheet';
|
|
18
|
+
import type {
|
|
19
|
+
BubblingEventHandler,
|
|
20
|
+
DirectEventHandler,
|
|
21
|
+
Double,
|
|
22
|
+
Float,
|
|
23
|
+
Int32,
|
|
24
|
+
WithDefault,
|
|
25
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
26
|
+
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
|
|
27
|
+
import type {TextInputNativeCommands} from 'react-native/Libraries/Components/TextInput/TextInputNativeCommands';
|
|
28
|
+
|
|
29
|
+
import * as NativeComponentRegistry from 'react-native/Libraries/NativeComponent/NativeComponentRegistry';
|
|
30
|
+
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
|
31
|
+
|
|
32
|
+
export type KeyboardType =
|
|
33
|
+
// Cross Platform
|
|
34
|
+
| 'default'
|
|
35
|
+
| 'email-address'
|
|
36
|
+
| 'numeric'
|
|
37
|
+
| 'phone-pad'
|
|
38
|
+
| 'number-pad'
|
|
39
|
+
| 'decimal-pad'
|
|
40
|
+
| 'url'
|
|
41
|
+
// iOS-only
|
|
42
|
+
| 'ascii-capable'
|
|
43
|
+
| 'numbers-and-punctuation'
|
|
44
|
+
| 'name-phone-pad'
|
|
45
|
+
| 'twitter'
|
|
46
|
+
| 'web-search'
|
|
47
|
+
// Android-only
|
|
48
|
+
| 'visible-password';
|
|
49
|
+
|
|
50
|
+
export type ReturnKeyType =
|
|
51
|
+
// Cross Platform
|
|
52
|
+
| 'done'
|
|
53
|
+
| 'go'
|
|
54
|
+
| 'next'
|
|
55
|
+
| 'search'
|
|
56
|
+
| 'send'
|
|
57
|
+
// Android-only
|
|
58
|
+
| 'none'
|
|
59
|
+
| 'previous'
|
|
60
|
+
// iOS-only
|
|
61
|
+
| 'default'
|
|
62
|
+
| 'emergency-call'
|
|
63
|
+
| 'google'
|
|
64
|
+
| 'join'
|
|
65
|
+
| 'route'
|
|
66
|
+
| 'yahoo';
|
|
67
|
+
|
|
68
|
+
export type SubmitBehavior = 'submit' | 'blurAndSubmit' | 'newline';
|
|
69
|
+
|
|
70
|
+
export type NativeProps = $ReadOnly<{
|
|
71
|
+
// This allows us to inherit everything from ViewProps except for style (see below)
|
|
72
|
+
// This must be commented for Fabric codegen to work.
|
|
73
|
+
...$Diff<ViewProps, $ReadOnly<{style: ?ViewStyleProp}>>,
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Android props after this
|
|
77
|
+
*/
|
|
78
|
+
/**
|
|
79
|
+
* Specifies autocomplete hints for the system, so it can provide autofill. On Android, the system will always attempt to offer autofill by using heuristics to identify the type of content.
|
|
80
|
+
* To disable autocomplete, set `autoComplete` to `off`.
|
|
81
|
+
*
|
|
82
|
+
* *Android Only*
|
|
83
|
+
*
|
|
84
|
+
* Possible values for `autoComplete` are:
|
|
85
|
+
*
|
|
86
|
+
* - `birthdate-day`
|
|
87
|
+
* - `birthdate-full`
|
|
88
|
+
* - `birthdate-month`
|
|
89
|
+
* - `birthdate-year`
|
|
90
|
+
* - `cc-csc`
|
|
91
|
+
* - `cc-exp`
|
|
92
|
+
* - `cc-exp-day`
|
|
93
|
+
* - `cc-exp-month`
|
|
94
|
+
* - `cc-exp-year`
|
|
95
|
+
* - `cc-number`
|
|
96
|
+
* - `email`
|
|
97
|
+
* - `gender`
|
|
98
|
+
* - `name`
|
|
99
|
+
* - `name-family`
|
|
100
|
+
* - `name-given`
|
|
101
|
+
* - `name-middle`
|
|
102
|
+
* - `name-middle-initial`
|
|
103
|
+
* - `name-prefix`
|
|
104
|
+
* - `name-suffix`
|
|
105
|
+
* - `password`
|
|
106
|
+
* - `password-new`
|
|
107
|
+
* - `postal-address`
|
|
108
|
+
* - `postal-address-country`
|
|
109
|
+
* - `postal-address-extended`
|
|
110
|
+
* - `postal-address-extended-postal-code`
|
|
111
|
+
* - `postal-address-locality`
|
|
112
|
+
* - `postal-address-region`
|
|
113
|
+
* - `postal-code`
|
|
114
|
+
* - `street-address`
|
|
115
|
+
* - `sms-otp`
|
|
116
|
+
* - `tel`
|
|
117
|
+
* - `tel-country-code`
|
|
118
|
+
* - `tel-national`
|
|
119
|
+
* - `tel-device`
|
|
120
|
+
* - `username`
|
|
121
|
+
* - `username-new`
|
|
122
|
+
* - `off`
|
|
123
|
+
*
|
|
124
|
+
* @platform android
|
|
125
|
+
*/
|
|
126
|
+
autoComplete?: WithDefault<
|
|
127
|
+
| 'birthdate-day'
|
|
128
|
+
| 'birthdate-full'
|
|
129
|
+
| 'birthdate-month'
|
|
130
|
+
| 'birthdate-year'
|
|
131
|
+
| 'cc-csc'
|
|
132
|
+
| 'cc-exp'
|
|
133
|
+
| 'cc-exp-day'
|
|
134
|
+
| 'cc-exp-month'
|
|
135
|
+
| 'cc-exp-year'
|
|
136
|
+
| 'cc-number'
|
|
137
|
+
| 'email'
|
|
138
|
+
| 'gender'
|
|
139
|
+
| 'name'
|
|
140
|
+
| 'name-family'
|
|
141
|
+
| 'name-given'
|
|
142
|
+
| 'name-middle'
|
|
143
|
+
| 'name-middle-initial'
|
|
144
|
+
| 'name-prefix'
|
|
145
|
+
| 'name-suffix'
|
|
146
|
+
| 'password'
|
|
147
|
+
| 'password-new'
|
|
148
|
+
| 'postal-address'
|
|
149
|
+
| 'postal-address-country'
|
|
150
|
+
| 'postal-address-extended'
|
|
151
|
+
| 'postal-address-extended-postal-code'
|
|
152
|
+
| 'postal-address-locality'
|
|
153
|
+
| 'postal-address-region'
|
|
154
|
+
| 'postal-code'
|
|
155
|
+
| 'street-address'
|
|
156
|
+
| 'sms-otp'
|
|
157
|
+
| 'tel'
|
|
158
|
+
| 'tel-country-code'
|
|
159
|
+
| 'tel-national'
|
|
160
|
+
| 'tel-device'
|
|
161
|
+
| 'username'
|
|
162
|
+
| 'username-new'
|
|
163
|
+
| 'off',
|
|
164
|
+
'off',
|
|
165
|
+
>,
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Sets the return key to the label. Use it instead of `returnKeyType`.
|
|
169
|
+
* @platform android
|
|
170
|
+
*/
|
|
171
|
+
returnKeyLabel?: ?string,
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Sets the number of lines for a `TextInput`. Use it with multiline set to
|
|
175
|
+
* `true` to be able to fill the lines.
|
|
176
|
+
* @platform android
|
|
177
|
+
*/
|
|
178
|
+
numberOfLines?: ?Int32,
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* When `false`, if there is a small amount of space available around a text input
|
|
182
|
+
* (e.g. landscape orientation on a phone), the OS may choose to have the user edit
|
|
183
|
+
* the text inside of a full screen text input mode. When `true`, this feature is
|
|
184
|
+
* disabled and users will always edit the text directly inside of the text input.
|
|
185
|
+
* Defaults to `false`.
|
|
186
|
+
* @platform android
|
|
187
|
+
*/
|
|
188
|
+
disableFullscreenUI?: ?boolean,
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Set text break strategy on Android API Level 23+, possible values are `simple`, `highQuality`, `balanced`
|
|
192
|
+
* The default value is `simple`.
|
|
193
|
+
* @platform android
|
|
194
|
+
*/
|
|
195
|
+
textBreakStrategy?: WithDefault<
|
|
196
|
+
'simple' | 'highQuality' | 'balanced',
|
|
197
|
+
'simple',
|
|
198
|
+
>,
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* The color of the `TextInput` underline.
|
|
202
|
+
* @platform android
|
|
203
|
+
*/
|
|
204
|
+
underlineColorAndroid?: ?ColorValue,
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* If defined, the provided image resource will be rendered on the left.
|
|
208
|
+
* The image resource must be inside `/android/app/src/main/res/drawable` and referenced
|
|
209
|
+
* like
|
|
210
|
+
* ```
|
|
211
|
+
* <TextInput
|
|
212
|
+
* inlineImageLeft='search_icon'
|
|
213
|
+
* />
|
|
214
|
+
* ```
|
|
215
|
+
* @platform android
|
|
216
|
+
*/
|
|
217
|
+
inlineImageLeft?: ?string,
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Padding between the inline image, if any, and the text input itself.
|
|
221
|
+
* @platform android
|
|
222
|
+
*/
|
|
223
|
+
inlineImagePadding?: ?Int32,
|
|
224
|
+
|
|
225
|
+
importantForAutofill?: string /*?(
|
|
226
|
+
| 'auto'
|
|
227
|
+
| 'no'
|
|
228
|
+
| 'noExcludeDescendants'
|
|
229
|
+
| 'yes'
|
|
230
|
+
| 'yesExcludeDescendants'
|
|
231
|
+
),*/,
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* When `false`, it will prevent the soft keyboard from showing when the field is focused.
|
|
235
|
+
* Defaults to `true`.
|
|
236
|
+
*/
|
|
237
|
+
showSoftInputOnFocus?: ?boolean,
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* TextInput props after this
|
|
241
|
+
*/
|
|
242
|
+
/**
|
|
243
|
+
* Can tell `TextInput` to automatically capitalize certain characters.
|
|
244
|
+
*
|
|
245
|
+
* - `characters`: all characters.
|
|
246
|
+
* - `words`: first letter of each word.
|
|
247
|
+
* - `sentences`: first letter of each sentence (*default*).
|
|
248
|
+
* - `none`: don't auto capitalize anything.
|
|
249
|
+
*/
|
|
250
|
+
autoCapitalize?: WithDefault<
|
|
251
|
+
'none' | 'sentences' | 'words' | 'characters',
|
|
252
|
+
'none',
|
|
253
|
+
>,
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* If `false`, disables auto-correct. The default value is `true`.
|
|
257
|
+
*/
|
|
258
|
+
autoCorrect?: ?boolean,
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* If `true`, focuses the input on `componentDidMount`.
|
|
262
|
+
* The default value is `false`.
|
|
263
|
+
*/
|
|
264
|
+
autoFocus?: ?boolean,
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Specifies whether fonts should scale to respect Text Size accessibility settings. The
|
|
268
|
+
* default is `true`.
|
|
269
|
+
*/
|
|
270
|
+
allowFontScaling?: ?boolean,
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Specifies largest possible scale a font can reach when `allowFontScaling` is enabled.
|
|
274
|
+
* Possible values:
|
|
275
|
+
* `null/undefined` (default): inherit from the parent node or the global default (0)
|
|
276
|
+
* `0`: no max, ignore parent/global default
|
|
277
|
+
* `>= 1`: sets the maxFontSizeMultiplier of this node to this value
|
|
278
|
+
*/
|
|
279
|
+
maxFontSizeMultiplier?: ?Float,
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* If `false`, text is not editable. The default value is `true`.
|
|
283
|
+
*/
|
|
284
|
+
editable?: ?boolean,
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Determines which keyboard to open, e.g.`numeric`.
|
|
288
|
+
*
|
|
289
|
+
* The following values work across platforms:
|
|
290
|
+
*
|
|
291
|
+
* - `default`
|
|
292
|
+
* - `numeric`
|
|
293
|
+
* - `number-pad`
|
|
294
|
+
* - `decimal-pad`
|
|
295
|
+
* - `email-address`
|
|
296
|
+
* - `phone-pad`
|
|
297
|
+
* - `url`
|
|
298
|
+
*
|
|
299
|
+
* *Android Only*
|
|
300
|
+
*
|
|
301
|
+
* The following values work on Android only:
|
|
302
|
+
*
|
|
303
|
+
* - `visible-password`
|
|
304
|
+
*/
|
|
305
|
+
keyboardType?: WithDefault<KeyboardType, 'default'>,
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Determines how the return key should look. On Android you can also use
|
|
309
|
+
* `returnKeyLabel`.
|
|
310
|
+
*
|
|
311
|
+
* *Cross platform*
|
|
312
|
+
*
|
|
313
|
+
* The following values work across platforms:
|
|
314
|
+
*
|
|
315
|
+
* - `done`
|
|
316
|
+
* - `go`
|
|
317
|
+
* - `next`
|
|
318
|
+
* - `search`
|
|
319
|
+
* - `send`
|
|
320
|
+
*
|
|
321
|
+
* *Android Only*
|
|
322
|
+
*
|
|
323
|
+
* The following values work on Android only:
|
|
324
|
+
*
|
|
325
|
+
* - `none`
|
|
326
|
+
* - `previous`
|
|
327
|
+
*/
|
|
328
|
+
returnKeyType?: WithDefault<ReturnKeyType, 'done'>,
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Limits the maximum number of characters that can be entered. Use this
|
|
332
|
+
* instead of implementing the logic in JS to avoid flicker.
|
|
333
|
+
*/
|
|
334
|
+
maxLength?: ?Int32,
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* If `true`, the text input can be multiple lines.
|
|
338
|
+
* The default value is `false`.
|
|
339
|
+
*/
|
|
340
|
+
multiline?: ?boolean,
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Callback that is called when the text input is blurred.
|
|
344
|
+
* `target` is the reactTag of the element
|
|
345
|
+
*/
|
|
346
|
+
onBlur?: ?BubblingEventHandler<$ReadOnly<{target: Int32}>>,
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Callback that is called when the text input is focused.
|
|
350
|
+
* `target` is the reactTag of the element
|
|
351
|
+
*/
|
|
352
|
+
onFocus?: ?BubblingEventHandler<$ReadOnly<{target: Int32}>>,
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Callback that is called when the text input's text changes.
|
|
356
|
+
* `target` is the reactTag of the element
|
|
357
|
+
* TODO: differentiate between onChange and onChangeText
|
|
358
|
+
*/
|
|
359
|
+
onChange?: ?BubblingEventHandler<
|
|
360
|
+
$ReadOnly<{target: Int32, eventCount: Int32, text: string}>,
|
|
361
|
+
>,
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Callback that is called when the text input's text changes.
|
|
365
|
+
* Changed text is passed as an argument to the callback handler.
|
|
366
|
+
* TODO: differentiate between onChange and onChangeText
|
|
367
|
+
*/
|
|
368
|
+
onChangeText?: ?BubblingEventHandler<
|
|
369
|
+
$ReadOnly<{target: Int32, eventCount: Int32, text: string}>,
|
|
370
|
+
>,
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Callback that is called when the text input's content size changes.
|
|
374
|
+
* This will be called with
|
|
375
|
+
* `{ nativeEvent: { contentSize: { width, height } } }`.
|
|
376
|
+
*
|
|
377
|
+
* Only called for multiline text inputs.
|
|
378
|
+
*/
|
|
379
|
+
onContentSizeChange?: ?DirectEventHandler<
|
|
380
|
+
$ReadOnly<{
|
|
381
|
+
target: Int32,
|
|
382
|
+
contentSize: $ReadOnly<{width: Double, height: Double}>,
|
|
383
|
+
}>,
|
|
384
|
+
>,
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Callback that is called when text input ends.
|
|
388
|
+
*/
|
|
389
|
+
onEndEditing?: ?BubblingEventHandler<
|
|
390
|
+
$ReadOnly<{target: Int32, text: string}>,
|
|
391
|
+
>,
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Callback that is called when the text input selection is changed.
|
|
395
|
+
* This will be called with
|
|
396
|
+
* `{ nativeEvent: { selection: { start, end } } }`.
|
|
397
|
+
*/
|
|
398
|
+
onSelectionChange?: ?DirectEventHandler<
|
|
399
|
+
$ReadOnly<{
|
|
400
|
+
target: Int32,
|
|
401
|
+
selection: $ReadOnly<{start: Double, end: Double}>,
|
|
402
|
+
}>,
|
|
403
|
+
>,
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Callback that is called when the text input's submit button is pressed.
|
|
407
|
+
* Invalid if `multiline={true}` is specified.
|
|
408
|
+
*/
|
|
409
|
+
onSubmitEditing?: ?BubblingEventHandler<
|
|
410
|
+
$ReadOnly<{target: Int32, text: string}>,
|
|
411
|
+
>,
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Callback that is called when a key is pressed.
|
|
415
|
+
* This will be called with `{ nativeEvent: { key: keyValue } }`
|
|
416
|
+
* where `keyValue` is `'Enter'` or `'Backspace'` for respective keys and
|
|
417
|
+
* the typed-in character otherwise including `' '` for space.
|
|
418
|
+
* Fires before `onChange` callbacks.
|
|
419
|
+
*/
|
|
420
|
+
onKeyPress?: ?BubblingEventHandler<$ReadOnly<{target: Int32, key: string}>>,
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Invoked on content scroll with `{ nativeEvent: { contentOffset: { x, y } } }`.
|
|
424
|
+
* May also contain other properties from ScrollEvent but on Android contentSize
|
|
425
|
+
* is not provided for performance reasons.
|
|
426
|
+
*/
|
|
427
|
+
onScroll?: ?DirectEventHandler<
|
|
428
|
+
$ReadOnly<{
|
|
429
|
+
target: Int32,
|
|
430
|
+
responderIgnoreScroll: boolean,
|
|
431
|
+
contentInset: $ReadOnly<{
|
|
432
|
+
top: Double, // always 0 on Android
|
|
433
|
+
bottom: Double, // always 0 on Android
|
|
434
|
+
left: Double, // always 0 on Android
|
|
435
|
+
right: Double, // always 0 on Android
|
|
436
|
+
}>,
|
|
437
|
+
contentOffset: $ReadOnly<{
|
|
438
|
+
x: Double,
|
|
439
|
+
y: Double,
|
|
440
|
+
}>,
|
|
441
|
+
contentSize: $ReadOnly<{
|
|
442
|
+
width: Double, // always 0 on Android
|
|
443
|
+
height: Double, // always 0 on Android
|
|
444
|
+
}>,
|
|
445
|
+
layoutMeasurement: $ReadOnly<{
|
|
446
|
+
width: Double,
|
|
447
|
+
height: Double,
|
|
448
|
+
}>,
|
|
449
|
+
velocity: $ReadOnly<{
|
|
450
|
+
x: Double, // always 0 on Android
|
|
451
|
+
y: Double, // always 0 on Android
|
|
452
|
+
}>,
|
|
453
|
+
}>,
|
|
454
|
+
>,
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Invoked when the user performs the paste action.
|
|
458
|
+
*/
|
|
459
|
+
onPaste?: ?DirectEventHandler<
|
|
460
|
+
$ReadOnly<{|
|
|
461
|
+
target: Int32,
|
|
462
|
+
items: $ReadOnlyArray<
|
|
463
|
+
$ReadOnly<{|
|
|
464
|
+
type: string,
|
|
465
|
+
data: string,
|
|
466
|
+
|}>,
|
|
467
|
+
>,
|
|
468
|
+
|}>,
|
|
469
|
+
>,
|
|
470
|
+
/**
|
|
471
|
+
* The string that will be rendered before text input has been entered.
|
|
472
|
+
*/
|
|
473
|
+
placeholder?: ?Stringish,
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* The text color of the placeholder string.
|
|
477
|
+
*/
|
|
478
|
+
placeholderTextColor?: ?ColorValue,
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* If `true`, the text input obscures the text entered so that sensitive text
|
|
482
|
+
* like passwords stay secure. The default value is `false`. Does not work with 'multiline={true}'.
|
|
483
|
+
*/
|
|
484
|
+
secureTextEntry?: ?boolean,
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* The highlight and cursor color of the text input.
|
|
488
|
+
*/
|
|
489
|
+
selectionColor?: ?ColorValue,
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* The text selection handle color.
|
|
493
|
+
*/
|
|
494
|
+
selectionHandleColor?: ?ColorValue,
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* The start and end of the text input's selection. Set start and end to
|
|
498
|
+
* the same value to position the cursor.
|
|
499
|
+
*/
|
|
500
|
+
selection?: ?$ReadOnly<{
|
|
501
|
+
start: Int32,
|
|
502
|
+
end?: ?Int32,
|
|
503
|
+
}>,
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* The value to show for the text input. `TextInput` is a controlled
|
|
507
|
+
* component, which means the native value will be forced to match this
|
|
508
|
+
* value prop if provided. For most uses, this works great, but in some
|
|
509
|
+
* cases this may cause flickering - one common cause is preventing edits
|
|
510
|
+
* by keeping value the same. In addition to simply setting the same value,
|
|
511
|
+
* either set `editable={false}`, or set/update `maxLength` to prevent
|
|
512
|
+
* unwanted edits without flicker.
|
|
513
|
+
*/
|
|
514
|
+
value?: ?string,
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Provides an initial value that will change when the user starts typing.
|
|
518
|
+
* Useful for simple use-cases where you do not want to deal with listening
|
|
519
|
+
* to events and updating the value prop to keep the controlled state in sync.
|
|
520
|
+
*/
|
|
521
|
+
defaultValue?: ?string,
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* If `true`, all text will automatically be selected on focus.
|
|
525
|
+
*/
|
|
526
|
+
selectTextOnFocus?: ?boolean,
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* If `true`, the text field will blur when submitted.
|
|
530
|
+
* The default value is true for single-line fields and false for
|
|
531
|
+
* multiline fields. Note that for multiline fields, setting `blurOnSubmit`
|
|
532
|
+
* to `true` means that pressing return will blur the field and trigger the
|
|
533
|
+
* `onSubmitEditing` event instead of inserting a newline into the field.
|
|
534
|
+
*
|
|
535
|
+
* @deprecated
|
|
536
|
+
* Note that `submitBehavior` now takes the place of `blurOnSubmit` and will
|
|
537
|
+
* override any behavior defined by `blurOnSubmit`.
|
|
538
|
+
* @see submitBehavior
|
|
539
|
+
*/
|
|
540
|
+
blurOnSubmit?: ?boolean,
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* When the return key is pressed,
|
|
544
|
+
*
|
|
545
|
+
* For single line inputs:
|
|
546
|
+
*
|
|
547
|
+
* - `'newline`' defaults to `'blurAndSubmit'`
|
|
548
|
+
* - `undefined` defaults to `'blurAndSubmit'`
|
|
549
|
+
*
|
|
550
|
+
* For multiline inputs:
|
|
551
|
+
*
|
|
552
|
+
* - `'newline'` adds a newline
|
|
553
|
+
* - `undefined` defaults to `'newline'`
|
|
554
|
+
*
|
|
555
|
+
* For both single line and multiline inputs:
|
|
556
|
+
*
|
|
557
|
+
* - `'submit'` will only send a submit event and not blur the input
|
|
558
|
+
* - `'blurAndSubmit`' will both blur the input and send a submit event
|
|
559
|
+
*/
|
|
560
|
+
submitBehavior?: ?SubmitBehavior,
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Note that not all Text styles are supported, an incomplete list of what is not supported includes:
|
|
564
|
+
*
|
|
565
|
+
* - `borderLeftWidth`
|
|
566
|
+
* - `borderTopWidth`
|
|
567
|
+
* - `borderRightWidth`
|
|
568
|
+
* - `borderBottomWidth`
|
|
569
|
+
* - `borderTopLeftRadius`
|
|
570
|
+
* - `borderTopRightRadius`
|
|
571
|
+
* - `borderBottomRightRadius`
|
|
572
|
+
* - `borderBottomLeftRadius`
|
|
573
|
+
*
|
|
574
|
+
* see [Issue#7070](https://github.com/facebook/react-native/issues/7070)
|
|
575
|
+
* for more detail.
|
|
576
|
+
*
|
|
577
|
+
* [Styles](docs/style.html)
|
|
578
|
+
*/
|
|
579
|
+
// TODO: figure out what to do with this style prop for codegen/Fabric purposes
|
|
580
|
+
// This must be commented for Fabric codegen to work; it's currently not possible
|
|
581
|
+
// to override the default View style prop in codegen.
|
|
582
|
+
style?: ?TextStyleProp,
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* If `true`, caret is hidden. The default value is `false`.
|
|
586
|
+
* This property is supported only for single-line TextInput component on iOS.
|
|
587
|
+
*/
|
|
588
|
+
caretHidden?: ?boolean,
|
|
589
|
+
|
|
590
|
+
/*
|
|
591
|
+
* If `true`, contextMenuHidden is hidden. The default value is `false`.
|
|
592
|
+
*/
|
|
593
|
+
contextMenuHidden?: ?boolean,
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* The following are props that `BaseTextShadowNode` takes. It is unclear if they
|
|
597
|
+
* are used by TextInput.
|
|
598
|
+
*/
|
|
599
|
+
textShadowColor?: ?ColorValue,
|
|
600
|
+
textShadowRadius?: ?Float,
|
|
601
|
+
textDecorationLine?: ?string,
|
|
602
|
+
fontStyle?: ?string,
|
|
603
|
+
textShadowOffset?: ?$ReadOnly<{width?: ?Double, height?: ?Double}>,
|
|
604
|
+
lineHeight?: ?Float,
|
|
605
|
+
textTransform?: ?string,
|
|
606
|
+
color?: ?Int32,
|
|
607
|
+
letterSpacing?: ?Float,
|
|
608
|
+
fontSize?: ?Float,
|
|
609
|
+
textAlign?: ?string,
|
|
610
|
+
includeFontPadding?: ?boolean,
|
|
611
|
+
fontWeight?: ?string,
|
|
612
|
+
fontFamily?: ?string,
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* I cannot find where these are defined but JS complains without them.
|
|
616
|
+
*/
|
|
617
|
+
textAlignVertical?: ?string,
|
|
618
|
+
cursorColor?: ?ColorValue,
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* "Private" fields used by TextInput.js and not users of this component directly
|
|
622
|
+
*/
|
|
623
|
+
mostRecentEventCount: Int32,
|
|
624
|
+
text?: ?string,
|
|
625
|
+
}>;
|
|
626
|
+
|
|
627
|
+
type NativeType = HostComponent<NativeProps>;
|
|
628
|
+
|
|
629
|
+
type NativeCommands = TextInputNativeCommands<NativeType>;
|
|
630
|
+
|
|
631
|
+
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
632
|
+
supportedCommands: ['focus', 'blur', 'setTextAndSelection'],
|
|
633
|
+
});
|
|
634
|
+
|
|
635
|
+
export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = {
|
|
636
|
+
uiViewClassName: 'UKeyTextInput',
|
|
637
|
+
bubblingEventTypes: {
|
|
638
|
+
topBlur: {
|
|
639
|
+
phasedRegistrationNames: {
|
|
640
|
+
bubbled: 'onBlur',
|
|
641
|
+
captured: 'onBlurCapture',
|
|
642
|
+
},
|
|
643
|
+
},
|
|
644
|
+
topEndEditing: {
|
|
645
|
+
phasedRegistrationNames: {
|
|
646
|
+
bubbled: 'onEndEditing',
|
|
647
|
+
captured: 'onEndEditingCapture',
|
|
648
|
+
},
|
|
649
|
+
},
|
|
650
|
+
topFocus: {
|
|
651
|
+
phasedRegistrationNames: {
|
|
652
|
+
bubbled: 'onFocus',
|
|
653
|
+
captured: 'onFocusCapture',
|
|
654
|
+
},
|
|
655
|
+
},
|
|
656
|
+
topKeyPress: {
|
|
657
|
+
phasedRegistrationNames: {
|
|
658
|
+
bubbled: 'onKeyPress',
|
|
659
|
+
captured: 'onKeyPressCapture',
|
|
660
|
+
},
|
|
661
|
+
},
|
|
662
|
+
topSubmitEditing: {
|
|
663
|
+
phasedRegistrationNames: {
|
|
664
|
+
bubbled: 'onSubmitEditing',
|
|
665
|
+
captured: 'onSubmitEditingCapture',
|
|
666
|
+
},
|
|
667
|
+
},
|
|
668
|
+
},
|
|
669
|
+
directEventTypes: {
|
|
670
|
+
topScroll: {
|
|
671
|
+
registrationName: 'onScroll',
|
|
672
|
+
},
|
|
673
|
+
topPaste: {
|
|
674
|
+
registrationName: 'onPaste',
|
|
675
|
+
},
|
|
676
|
+
},
|
|
677
|
+
validAttributes: {
|
|
678
|
+
maxFontSizeMultiplier: true,
|
|
679
|
+
adjustsFontSizeToFit: true,
|
|
680
|
+
minimumFontScale: true,
|
|
681
|
+
autoFocus: true,
|
|
682
|
+
placeholder: true,
|
|
683
|
+
inlineImagePadding: true,
|
|
684
|
+
contextMenuHidden: true,
|
|
685
|
+
textShadowColor: {
|
|
686
|
+
process: require('react-native/Libraries/StyleSheet/processColor').default,
|
|
687
|
+
},
|
|
688
|
+
maxLength: true,
|
|
689
|
+
selectTextOnFocus: true,
|
|
690
|
+
textShadowRadius: true,
|
|
691
|
+
underlineColorAndroid: {
|
|
692
|
+
process: require('react-native/Libraries/StyleSheet/processColor').default,
|
|
693
|
+
},
|
|
694
|
+
textDecorationLine: true,
|
|
695
|
+
submitBehavior: true,
|
|
696
|
+
textAlignVertical: true,
|
|
697
|
+
fontStyle: true,
|
|
698
|
+
textShadowOffset: true,
|
|
699
|
+
selectionColor: {process: require('react-native/Libraries/StyleSheet/processColor').default},
|
|
700
|
+
selectionHandleColor: {
|
|
701
|
+
process: require('react-native/Libraries/StyleSheet/processColor').default,
|
|
702
|
+
},
|
|
703
|
+
placeholderTextColor: {
|
|
704
|
+
process: require('react-native/Libraries/StyleSheet/processColor').default,
|
|
705
|
+
},
|
|
706
|
+
importantForAutofill: true,
|
|
707
|
+
lineHeight: true,
|
|
708
|
+
textTransform: true,
|
|
709
|
+
returnKeyType: true,
|
|
710
|
+
keyboardType: true,
|
|
711
|
+
multiline: true,
|
|
712
|
+
color: {process: require('react-native/Libraries/StyleSheet/processColor').default},
|
|
713
|
+
autoComplete: true,
|
|
714
|
+
numberOfLines: true,
|
|
715
|
+
letterSpacing: true,
|
|
716
|
+
returnKeyLabel: true,
|
|
717
|
+
fontSize: true,
|
|
718
|
+
onKeyPress: true,
|
|
719
|
+
cursorColor: {process: require('react-native/Libraries/StyleSheet/processColor').default},
|
|
720
|
+
text: true,
|
|
721
|
+
showSoftInputOnFocus: true,
|
|
722
|
+
textAlign: true,
|
|
723
|
+
autoCapitalize: true,
|
|
724
|
+
autoCorrect: true,
|
|
725
|
+
caretHidden: true,
|
|
726
|
+
secureTextEntry: true,
|
|
727
|
+
textBreakStrategy: true,
|
|
728
|
+
onScroll: true,
|
|
729
|
+
onContentSizeChange: true,
|
|
730
|
+
onPaste: true,
|
|
731
|
+
disableFullscreenUI: true,
|
|
732
|
+
includeFontPadding: true,
|
|
733
|
+
fontWeight: true,
|
|
734
|
+
fontFamily: true,
|
|
735
|
+
allowFontScaling: true,
|
|
736
|
+
onSelectionChange: true,
|
|
737
|
+
mostRecentEventCount: true,
|
|
738
|
+
inlineImageLeft: true,
|
|
739
|
+
editable: true,
|
|
740
|
+
fontVariant: true,
|
|
741
|
+
borderBottomRightRadius: true,
|
|
742
|
+
borderBottomColor: {
|
|
743
|
+
process: require('react-native/Libraries/StyleSheet/processColor').default,
|
|
744
|
+
},
|
|
745
|
+
borderRadius: true,
|
|
746
|
+
borderRightColor: {
|
|
747
|
+
process: require('react-native/Libraries/StyleSheet/processColor').default,
|
|
748
|
+
},
|
|
749
|
+
borderColor: {process: require('react-native/Libraries/StyleSheet/processColor').default},
|
|
750
|
+
borderTopRightRadius: true,
|
|
751
|
+
borderStyle: true,
|
|
752
|
+
borderBottomLeftRadius: true,
|
|
753
|
+
borderLeftColor: {
|
|
754
|
+
process: require('react-native/Libraries/StyleSheet/processColor').default,
|
|
755
|
+
},
|
|
756
|
+
borderTopLeftRadius: true,
|
|
757
|
+
borderTopColor: {process: require('react-native/Libraries/StyleSheet/processColor').default},
|
|
758
|
+
},
|
|
759
|
+
};
|
|
760
|
+
|
|
761
|
+
let AndroidTextInputNativeComponent = NativeComponentRegistry.get<NativeProps>(
|
|
762
|
+
'UKeyTextInput',
|
|
763
|
+
() => __INTERNAL_VIEW_CONFIG,
|
|
764
|
+
);
|
|
765
|
+
|
|
766
|
+
// flowlint-next-line unclear-type:off
|
|
767
|
+
export default ((AndroidTextInputNativeComponent: any): HostComponent<NativeProps>);
|