@office-iss/react-native-win32 0.0.0-canary.290 → 0.0.0-canary.292

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.
Files changed (128) hide show
  1. package/.flowconfig +1 -1
  2. package/CHANGELOG.json +31 -1
  3. package/CHANGELOG.md +20 -4
  4. package/Libraries/Alert/RCTAlertManager.js +17 -0
  5. package/Libraries/Animated/AnimatedEvent.js +4 -3
  6. package/Libraries/Animated/AnimatedExports.js.flow +2 -0
  7. package/Libraries/Animated/AnimatedImplementation.js +2 -2
  8. package/Libraries/Animated/components/AnimatedScrollView.js +48 -43
  9. package/Libraries/Animated/nodes/AnimatedValue.js +2 -1
  10. package/Libraries/BatchedBridge/MessageQueue.js +2 -2
  11. package/Libraries/Blob/FileReader.js +219 -8
  12. package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.js +17 -0
  13. package/Libraries/Components/Button.js +1 -1
  14. package/Libraries/Components/Button.win32.js +1 -1
  15. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -3
  16. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.ios.js +15 -0
  17. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +6 -66
  18. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js.flow +18 -0
  19. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidFallback.js +71 -0
  20. package/Libraries/Components/Keyboard/Keyboard.js +4 -2
  21. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +6 -3
  22. package/Libraries/Components/Pressable/Pressable.js +2 -0
  23. package/Libraries/Components/Pressable/Pressable.win32.js +2 -0
  24. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +12 -2
  25. package/Libraries/Components/RefreshControl/RefreshControl.js +1 -1
  26. package/Libraries/Components/ScrollView/ScrollView.js +128 -116
  27. package/Libraries/Components/StaticRenderer.js +1 -1
  28. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +1 -1
  29. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -4
  30. package/Libraries/Components/TextInput/TextInput.flow.js +35 -43
  31. package/Libraries/Components/TextInput/TextInput.flow.win32.js +1184 -0
  32. package/Libraries/Components/TextInput/TextInput.js +65 -1005
  33. package/Libraries/Components/TextInput/TextInput.win32.js +67 -1037
  34. package/Libraries/Components/ToastAndroid/ToastAndroid.ios.js +13 -0
  35. package/Libraries/Components/ToastAndroid/ToastAndroid.js +4 -32
  36. package/Libraries/Components/ToastAndroid/ToastAndroid.js.flow +109 -0
  37. package/Libraries/Components/ToastAndroid/ToastAndroid.win32.js +4 -32
  38. package/Libraries/Components/ToastAndroid/ToastAndroidFallback.js +45 -0
  39. package/Libraries/Components/Touchable/Touchable.js +5 -5
  40. package/Libraries/Components/Touchable/Touchable.win32.js +5 -5
  41. package/Libraries/Components/Touchable/TouchableBounce.js +12 -6
  42. package/Libraries/Components/Touchable/TouchableHighlight.js +9 -6
  43. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +4 -4
  44. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +4 -4
  45. package/Libraries/Components/Touchable/TouchableOpacity.js +11 -5
  46. package/Libraries/Components/View/ViewAccessibility.js +7 -0
  47. package/Libraries/Components/View/ViewAccessibility.win32.js +7 -0
  48. package/Libraries/Components/View/ViewPropTypes.js +1 -1
  49. package/Libraries/Components/View/ViewPropTypes.win32.js +1 -1
  50. package/Libraries/Core/ReactNativeVersion.js +1 -1
  51. package/Libraries/EventEmitter/NativeEventEmitter.js +4 -1
  52. package/Libraries/Image/Image.js +17 -0
  53. package/Libraries/Image/Image.js.flow +2 -2
  54. package/Libraries/Image/ImageInjection.js +1 -1
  55. package/Libraries/Image/ImageProps.js +5 -4
  56. package/Libraries/Image/ImageTypes.flow.js +1 -1
  57. package/Libraries/Lists/FlatList.js +1 -1
  58. package/Libraries/Lists/SectionList.js +1 -1
  59. package/Libraries/Lists/SectionListModern.js +2 -1
  60. package/Libraries/LogBox/LogBoxNotificationContainer.js +1 -1
  61. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.win32.js +140 -0
  62. package/Libraries/Modal/Modal.js +3 -3
  63. package/Libraries/NativeComponent/BaseViewConfig.js +17 -0
  64. package/Libraries/NativeComponent/PlatformBaseViewConfig.js +2 -2
  65. package/Libraries/Network/RCTNetworking.js +17 -0
  66. package/Libraries/Network/XMLHttpRequest.js +781 -10
  67. package/Libraries/NewAppScreen/components/DebugInstructions.js +1 -1
  68. package/Libraries/NewAppScreen/components/Header.js +1 -1
  69. package/Libraries/NewAppScreen/components/HermesBadge.js +1 -1
  70. package/Libraries/NewAppScreen/components/LearnMoreLinks.js +3 -3
  71. package/Libraries/NewAppScreen/components/ReloadInstructions.js +1 -1
  72. package/Libraries/Performance/Systrace.js +7 -7
  73. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +2 -2
  74. package/Libraries/Settings/Settings.js +13 -19
  75. package/Libraries/Settings/Settings.win32.js +19 -20
  76. package/Libraries/Settings/SettingsFallback.js +33 -0
  77. package/Libraries/StyleSheet/PlatformColorValueTypes.js +15 -0
  78. package/Libraries/StyleSheet/Rect.js +1 -0
  79. package/Libraries/StyleSheet/StyleSheet.js.flow +3 -3
  80. package/Libraries/StyleSheet/StyleSheetTypes.js +28 -30
  81. package/Libraries/StyleSheet/flattenStyle.js +7 -1
  82. package/Libraries/Text/Text.js +3 -3
  83. package/Libraries/Text/Text.win32.js +3 -3
  84. package/Libraries/Text/TextProps.js +1 -1
  85. package/Libraries/Text/TextProps.win32.js +1 -1
  86. package/Libraries/Utilities/Appearance.js +2 -0
  87. package/Libraries/Utilities/BackHandler.js +17 -0
  88. package/Libraries/Utilities/Platform.js +17 -0
  89. package/Libraries/Utilities/PlatformTypes.js +2 -0
  90. package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
  91. package/Libraries/WebSocket/WebSocket.js +313 -8
  92. package/flow/global.js +0 -2
  93. package/index.win32.js +5 -5
  94. package/overrides.json +29 -17
  95. package/package.json +12 -12
  96. package/src/private/animated/NativeAnimatedHelper.js +1 -1
  97. package/src/private/animated/NativeAnimatedHelper.win32.js +1 -1
  98. package/src/private/animated/createAnimatedPropsHook.js +2 -27
  99. package/src/private/components/{SafeAreaView_INTERNAL_DO_NOT_USE.js → safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE.js} +6 -6
  100. package/src/private/components/{HScrollViewNativeComponents.js → scrollview/HScrollViewNativeComponents.js} +8 -8
  101. package/src/private/components/scrollview/VScrollViewNativeComponents.js +25 -0
  102. package/src/private/featureflags/ReactNativeFeatureFlags.js +21 -32
  103. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +5 -6
  104. package/src/private/inspector/BorderBox.js +1 -1
  105. package/src/private/inspector/BoxInspector.js +1 -1
  106. package/src/private/inspector/ElementBox.js +1 -1
  107. package/src/private/inspector/ElementProperties.js +1 -1
  108. package/src/private/inspector/Inspector.js +2 -2
  109. package/src/private/inspector/InspectorOverlay.js +1 -1
  110. package/src/private/inspector/InspectorPanel.js +1 -1
  111. package/src/private/inspector/NetworkOverlay.js +1 -1
  112. package/src/private/inspector/PerformanceOverlay.js +1 -1
  113. package/src/private/inspector/StyleInspector.js +1 -1
  114. package/src/private/types/HostComponent.js +1 -1
  115. package/src/private/types/HostInstance.js +10 -2
  116. package/src/private/webapis/performance/Performance.js +1 -3
  117. package/Libraries/Blob/FileReader_new.js +0 -231
  118. package/Libraries/Blob/FileReader_old.js +0 -186
  119. package/Libraries/Events/CustomEvent.js +0 -32
  120. package/Libraries/Events/EventPolyfill.js +0 -239
  121. package/Libraries/Network/XMLHttpRequest_new.js +0 -794
  122. package/Libraries/Network/XMLHttpRequest_old.js +0 -701
  123. package/Libraries/WebSocket/WebSocketEvent.js +0 -30
  124. package/Libraries/WebSocket/WebSocket_new.js +0 -325
  125. package/Libraries/WebSocket/WebSocket_old.js +0 -297
  126. package/Libraries/WebSocket/__mocks__/event-target-shim.js +0 -27
  127. package/src/private/components/VScrollViewNativeComponents.js +0 -25
  128. package/src/types/third_party/event-target-shim.d.ts +0 -392
@@ -12,19 +12,47 @@ import type {HostInstance} from '../../../src/private/types/HostInstance';
12
12
  import type {____TextStyle_Internal as TextStyleInternal} from '../../StyleSheet/StyleSheetTypes';
13
13
  import type {
14
14
  GestureResponderEvent,
15
- NativeSyntheticEvent,
16
15
  ScrollEvent,
17
16
  } from '../../Types/CoreEventTypes';
18
- import type {ViewProps} from '../View/ViewPropTypes';
19
- import type {TextInputInstance, TextInputType} from './TextInput.flow';
17
+ import type {
18
+ AutoCapitalize,
19
+ EnterKeyHintType,
20
+ EnterKeyHintTypeAndroid,
21
+ EnterKeyHintTypeIOS,
22
+ EnterKeyHintTypeOptions,
23
+ InputModeOptions,
24
+ KeyboardType,
25
+ KeyboardTypeAndroid,
26
+ KeyboardTypeIOS,
27
+ KeyboardTypeOptions,
28
+ ReturnKeyType,
29
+ ReturnKeyTypeAndroid,
30
+ ReturnKeyTypeIOS,
31
+ ReturnKeyTypeOptions,
32
+ Selection,
33
+ SubmitBehavior,
34
+ TextContentType,
35
+ TextInputAndroidProps,
36
+ TextInputBlurEvent,
37
+ TextInputChangeEvent,
38
+ TextInputContentSizeChangeEvent,
39
+ TextInputEditingEvent,
40
+ TextInputEndEditingEvent,
41
+ TextInputEvent,
42
+ TextInputFocusEvent,
43
+ TextInputInstance,
44
+ TextInputIOSProps,
45
+ TextInputKeyPressEvent,
46
+ TextInputProps,
47
+ TextInputSelectionChangeEvent,
48
+ TextInputSubmitEditingEvent,
49
+ TextInputType,
50
+ TextInputWindowsProps, // [Windows]
51
+ } from './TextInput.flow.win32';
20
52
 
21
53
  import usePressability from '../../Pressability/usePressability';
22
54
  import flattenStyle from '../../StyleSheet/flattenStyle';
23
- import StyleSheet, {
24
- type ColorValue,
25
- type TextStyleProp,
26
- type ViewStyleProp,
27
- } from '../../StyleSheet/StyleSheet';
55
+ import StyleSheet, {type TextStyleProp} from '../../StyleSheet/StyleSheet';
28
56
  import Text from '../../Text/Text';
29
57
  import TextAncestor from '../../Text/TextAncestor';
30
58
  import Platform from '../../Utilities/Platform';
@@ -68,1037 +96,39 @@ else if (Platform.OS === 'win32') {
68
96
  }
69
97
  // Windows]
70
98
 
71
- /**
72
- * @see TextInputProps.onChange
73
- */
74
- type TextInputChangeEventData = $ReadOnly<{
75
- eventCount: number,
76
- target: number,
77
- text: string,
78
- }>;
79
-
80
- export type TextInputChangeEvent =
81
- NativeSyntheticEvent<TextInputChangeEventData>;
82
-
83
- export type TextInputEvent = NativeSyntheticEvent<
84
- $ReadOnly<{
85
- eventCount: number,
86
- previousText: string,
87
- range: $ReadOnly<{
88
- start: number,
89
- end: number,
90
- }>,
91
- target: number,
92
- text: string,
93
- }>,
94
- >;
95
-
96
- type TextInputContentSizeChangeEventData = $ReadOnly<{
97
- target: number,
98
- contentSize: $ReadOnly<{
99
- width: number,
100
- height: number,
101
- }>,
102
- }>;
103
-
104
- /**
105
- * @see TextInputProps.onContentSizeChange
106
- */
107
- export type TextInputContentSizeChangeEvent =
108
- NativeSyntheticEvent<TextInputContentSizeChangeEventData>;
109
-
110
- export type TargetEvent = $ReadOnly<{
111
- target: number,
112
- }>;
113
-
114
- type TextInputFocusEventData = TargetEvent;
115
-
116
- /**
117
- * @see TextInputProps.onBlur
118
- */
119
- export type TextInputBlurEvent = NativeSyntheticEvent<TextInputFocusEventData>;
120
-
121
- /**
122
- * @see TextInputProps.onFocus
123
- */
124
- export type TextInputFocusEvent = NativeSyntheticEvent<TextInputFocusEventData>;
125
-
126
- type TextInputScrollEventData = {
127
- contentOffset: {x: number, y: number},
99
+ export type {
100
+ AutoCapitalize,
101
+ EnterKeyHintType,
102
+ EnterKeyHintTypeAndroid,
103
+ EnterKeyHintTypeIOS,
104
+ EnterKeyHintTypeOptions,
105
+ InputModeOptions,
106
+ KeyboardType,
107
+ KeyboardTypeAndroid,
108
+ KeyboardTypeIOS,
109
+ KeyboardTypeOptions,
110
+ ReturnKeyType,
111
+ ReturnKeyTypeAndroid,
112
+ ReturnKeyTypeIOS,
113
+ ReturnKeyTypeOptions,
114
+ SubmitBehavior,
115
+ TextContentType,
116
+ TextInputAndroidProps,
117
+ TextInputBlurEvent,
118
+ TextInputChangeEvent,
119
+ TextInputContentSizeChangeEvent,
120
+ TextInputEditingEvent,
121
+ TextInputEndEditingEvent,
122
+ TextInputEvent,
123
+ TextInputFocusEvent,
124
+ TextInputIOSProps,
125
+ TextInputKeyPressEvent,
126
+ TextInputProps,
127
+ TextInputSelectionChangeEvent,
128
+ TextInputSubmitEditingEvent,
129
+ TextInputWindowsProps, // [Windows]
128
130
  };
129
131
 
130
- /**
131
- * @see TextInputProps.onScroll
132
- */
133
- export type TextInputScrollEvent =
134
- NativeSyntheticEvent<TextInputScrollEventData>;
135
-
136
- type Selection = $ReadOnly<{
137
- start: number,
138
- end: number,
139
- }>;
140
-
141
- type TextInputSelectionChangeEventData = $ReadOnly<{
142
- ...TargetEvent,
143
- selection: Selection,
144
- }>;
145
-
146
- /**
147
- * @see TextInputProps.onSelectionChange
148
- */
149
- export type TextInputSelectionChangeEvent =
150
- NativeSyntheticEvent<TextInputSelectionChangeEventData>;
151
-
152
- type TextInputKeyPressEventData = $ReadOnly<{
153
- ...TargetEvent,
154
- key: string,
155
- target?: ?number,
156
- eventCount?: ?number,
157
- }>;
158
-
159
- /**
160
- * @see TextInputProps.onKeyPress
161
- */
162
- export type TextInputKeyPressEvent =
163
- NativeSyntheticEvent<TextInputKeyPressEventData>;
164
-
165
- type TextInputEndEditingEventData = $ReadOnly<{
166
- ...TargetEvent,
167
- eventCount: number,
168
- text: string,
169
- }>;
170
-
171
- /**
172
- * @see TextInputProps.onEndEditing
173
- */
174
- export type TextInputEndEditingEvent =
175
- NativeSyntheticEvent<TextInputEndEditingEventData>;
176
-
177
- type TextInputSubmitEditingEventData = $ReadOnly<{
178
- ...TargetEvent,
179
- eventCount: number,
180
- text: string,
181
- }>;
182
-
183
- /**
184
- * @see TextInputProps.onSubmitEditing
185
- */
186
- export type TextInputSubmitEditingEvent =
187
- NativeSyntheticEvent<TextInputSubmitEditingEventData>;
188
-
189
- export type TextInputEditingEvent =
190
- NativeSyntheticEvent<TextInputEndEditingEventData>;
191
-
192
- type DataDetectorTypesType =
193
- | 'phoneNumber'
194
- | 'link'
195
- | 'address'
196
- | 'calendarEvent'
197
- | 'trackingNumber'
198
- | 'flightNumber'
199
- | 'lookupSuggestion'
200
- | 'none'
201
- | 'all';
202
-
203
- export type KeyboardType =
204
- | 'default'
205
- | 'email-address'
206
- | 'numeric'
207
- | 'phone-pad'
208
- | 'number-pad'
209
- | 'decimal-pad'
210
- | 'url';
211
-
212
- export type KeyboardTypeIOS =
213
- | 'ascii-capable'
214
- | 'numbers-and-punctuation'
215
- | 'name-phone-pad'
216
- | 'twitter'
217
- | 'web-search'
218
- // iOS 10+ only
219
- | 'ascii-capable-number-pad';
220
-
221
- export type KeyboardTypeAndroid = 'visible-password';
222
-
223
- export type KeyboardTypeOptions =
224
- | KeyboardType
225
- | KeyboardTypeIOS
226
- | KeyboardTypeAndroid;
227
-
228
- export type InputModeOptions =
229
- | 'none'
230
- | 'text'
231
- | 'decimal'
232
- | 'numeric'
233
- | 'tel'
234
- | 'search'
235
- | 'email'
236
- | 'url';
237
-
238
- export type ReturnKeyType = 'done' | 'go' | 'next' | 'search' | 'send';
239
-
240
- export type ReturnKeyTypeIOS =
241
- | 'default'
242
- | 'emergency-call'
243
- | 'google'
244
- | 'join'
245
- | 'route'
246
- | 'yahoo';
247
-
248
- export type ReturnKeyTypeAndroid = 'none' | 'previous';
249
-
250
- export type ReturnKeyTypeOptions =
251
- | ReturnKeyType
252
- | ReturnKeyTypeIOS
253
- | ReturnKeyTypeAndroid;
254
-
255
- export type SubmitBehavior = 'submit' | 'blurAndSubmit' | 'newline';
256
-
257
- export type AutoCapitalize = 'none' | 'sentences' | 'words' | 'characters';
258
-
259
- export type TextContentType =
260
- | 'none'
261
- | 'URL'
262
- | 'addressCity'
263
- | 'addressCityAndState'
264
- | 'addressState'
265
- | 'countryName'
266
- | 'creditCardNumber'
267
- | 'creditCardExpiration'
268
- | 'creditCardExpirationMonth'
269
- | 'creditCardExpirationYear'
270
- | 'creditCardSecurityCode'
271
- | 'creditCardType'
272
- | 'creditCardName'
273
- | 'creditCardGivenName'
274
- | 'creditCardMiddleName'
275
- | 'creditCardFamilyName'
276
- | 'emailAddress'
277
- | 'familyName'
278
- | 'fullStreetAddress'
279
- | 'givenName'
280
- | 'jobTitle'
281
- | 'location'
282
- | 'middleName'
283
- | 'name'
284
- | 'namePrefix'
285
- | 'nameSuffix'
286
- | 'nickname'
287
- | 'organizationName'
288
- | 'postalCode'
289
- | 'streetAddressLine1'
290
- | 'streetAddressLine2'
291
- | 'sublocality'
292
- | 'telephoneNumber'
293
- | 'username'
294
- | 'password'
295
- | 'newPassword'
296
- | 'oneTimeCode'
297
- | 'birthdate'
298
- | 'birthdateDay'
299
- | 'birthdateMonth'
300
- | 'birthdateYear'
301
- | 'cellularEID'
302
- | 'cellularIMEI'
303
- | 'dateTime'
304
- | 'flightNumber'
305
- | 'shipmentTrackingNumber';
306
-
307
- export type EnterKeyHintTypeAndroid = 'previous';
308
-
309
- export type EnterKeyHintTypeIOS = 'enter';
310
-
311
- export type EnterKeyHintType = 'done' | 'go' | 'next' | 'search' | 'send';
312
-
313
- export type EnterKeyHintTypeOptions =
314
- | EnterKeyHintType
315
- | EnterKeyHintTypeAndroid
316
- | EnterKeyHintTypeIOS;
317
-
318
- type PasswordRules = string;
319
-
320
- export type TextInputIOSProps = $ReadOnly<{
321
- /**
322
- * If true, the keyboard shortcuts (undo/redo and copy buttons) are disabled. The default value is false.
323
- * @platform ios
324
- */
325
- disableKeyboardShortcuts?: ?boolean,
326
-
327
- /**
328
- * When the clear button should appear on the right side of the text view.
329
- * This property is supported only for single-line TextInput component.
330
- * @platform ios
331
- */
332
- clearButtonMode?: ?('never' | 'while-editing' | 'unless-editing' | 'always'),
333
-
334
- /**
335
- * If `true`, clears the text field automatically when editing begins.
336
- * @platform ios
337
- */
338
- clearTextOnFocus?: ?boolean,
339
-
340
- /**
341
- * Determines the types of data converted to clickable URLs in the text input.
342
- * Only valid if `multiline={true}` and `editable={false}`.
343
- * By default no data types are detected.
344
- *
345
- * You can provide one type or an array of many types.
346
- *
347
- * Possible values for `dataDetectorTypes` are:
348
- *
349
- * - `'phoneNumber'`
350
- * - `'link'`
351
- * - `'address'`
352
- * - `'calendarEvent'`
353
- * - `'none'`
354
- * - `'all'`
355
- *
356
- * @platform ios
357
- */
358
- dataDetectorTypes?:
359
- | ?DataDetectorTypesType
360
- | $ReadOnlyArray<DataDetectorTypesType>,
361
-
362
- /**
363
- * If `true`, the keyboard disables the return key when there is no text and
364
- * automatically enables it when there is text. The default value is `false`.
365
- * @platform ios
366
- */
367
- enablesReturnKeyAutomatically?: ?boolean,
368
-
369
- /**
370
- * An optional identifier which links a custom InputAccessoryView to
371
- * this text input. The InputAccessoryView is rendered above the
372
- * keyboard when this text input is focused.
373
- * @platform ios
374
- */
375
- inputAccessoryViewID?: ?string,
376
-
377
- /**
378
- * An optional label that overrides the default input accessory view button label.
379
- * @platform ios
380
- */
381
- inputAccessoryViewButtonLabel?: ?string,
382
-
383
- /**
384
- * Determines the color of the keyboard.
385
- * @platform ios
386
- */
387
- keyboardAppearance?: ?('default' | 'light' | 'dark'),
388
-
389
- /**
390
- * Provide rules for your password.
391
- * For example, say you want to require a password with at least eight characters consisting of a mix of uppercase and lowercase letters, at least one number, and at most two consecutive characters.
392
- * "required: upper; required: lower; required: digit; max-consecutive: 2; minlength: 8;"
393
- * @platform ios
394
- */
395
- passwordRules?: ?PasswordRules,
396
-
397
- /*
398
- * If `true`, allows TextInput to pass touch events to the parent component.
399
- * This allows components to be swipeable from the TextInput on iOS,
400
- * as is the case on Android by default.
401
- * If `false`, TextInput always asks to handle the input (except when disabled).
402
- * @platform ios
403
- */
404
- rejectResponderTermination?: ?boolean,
405
-
406
- /**
407
- * If `false`, scrolling of the text view will be disabled.
408
- * The default value is `true`. Does only work with 'multiline={true}'.
409
- * @platform ios
410
- */
411
- scrollEnabled?: ?boolean,
412
-
413
- /**
414
- * If `false`, disables spell-check style (i.e. red underlines).
415
- * The default value is inherited from `autoCorrect`.
416
- * @platform ios
417
- */
418
- spellCheck?: ?boolean,
419
-
420
- /**
421
- * Give the keyboard and the system information about the
422
- * expected semantic meaning for the content that users enter.
423
- * @platform ios
424
- */
425
- textContentType?: ?TextContentType,
426
-
427
- /**
428
- * Set line break strategy on iOS.
429
- * @platform ios
430
- */
431
- lineBreakStrategyIOS?: ?('none' | 'standard' | 'hangul-word' | 'push-out'),
432
-
433
- /**
434
- * Set line break mode on iOS.
435
- * @platform ios
436
- */
437
- lineBreakModeIOS?: ?(
438
- | 'wordWrapping'
439
- | 'char'
440
- | 'clip'
441
- | 'head'
442
- | 'middle'
443
- | 'tail'
444
- ),
445
-
446
- /**
447
- * If `false`, the iOS system will not insert an extra space after a paste operation
448
- * neither delete one or two spaces after a cut or delete operation.
449
- *
450
- * The default value is `true`.
451
- *
452
- * @platform ios
453
- */
454
- smartInsertDelete?: ?boolean,
455
- }>;
456
-
457
- export type TextInputAndroidProps = $ReadOnly<{
458
- /**
459
- * When provided it will set the color of the cursor (or "caret") in the component.
460
- * Unlike the behavior of `selectionColor` the cursor color will be set independently
461
- * from the color of the text selection box.
462
- * @platform android
463
- */
464
- cursorColor?: ?ColorValue,
465
-
466
- /**
467
- * When `false`, if there is a small amount of space available around a text input
468
- * (e.g. landscape orientation on a phone), the OS may choose to have the user edit
469
- * the text inside of a full screen text input mode. When `true`, this feature is
470
- * disabled and users will always edit the text directly inside of the text input.
471
- * Defaults to `false`.
472
- * @platform android
473
- */
474
- disableFullscreenUI?: ?boolean,
475
-
476
- /**
477
- * Determines whether the individual fields in your app should be included in a
478
- * view structure for autofill purposes on Android API Level 26+. Defaults to auto.
479
- * To disable auto complete, use `off`.
480
- *
481
- * *Android Only*
482
- *
483
- * The following values work on Android only:
484
- *
485
- * - `auto` - let Android decide
486
- * - `no` - not important for autofill
487
- * - `noExcludeDescendants` - this view and its children aren't important for autofill
488
- * - `yes` - is important for autofill
489
- * - `yesExcludeDescendants` - this view is important for autofill but its children aren't
490
- */
491
- importantForAutofill?: ?(
492
- | 'auto'
493
- | 'no'
494
- | 'noExcludeDescendants'
495
- | 'yes'
496
- | 'yesExcludeDescendants'
497
- ),
498
-
499
- /**
500
- * If defined, the provided image resource will be rendered on the left.
501
- * The image resource must be inside `/android/app/src/main/res/drawable` and referenced
502
- * like
503
- * ```
504
- * <TextInput
505
- * inlineImageLeft='search_icon'
506
- * />
507
- * ```
508
- * @platform android
509
- */
510
- inlineImageLeft?: ?string,
511
-
512
- /**
513
- * Padding between the inline image, if any, and the text input itself.
514
- * @platform android
515
- */
516
- inlineImagePadding?: ?number,
517
-
518
- /**
519
- * Sets the number of lines for a `TextInput`. Use it with multiline set to
520
- * `true` to be able to fill the lines.
521
- * @platform android
522
- */
523
- numberOfLines?: ?number,
524
-
525
- /**
526
- * Sets the return key to the label. Use it instead of `returnKeyType`.
527
- * @platform android
528
- */
529
- returnKeyLabel?: ?string,
530
-
531
- /**
532
- * Sets the number of rows for a `TextInput`. Use it with multiline set to
533
- * `true` to be able to fill the lines.
534
- * @platform android
535
- */
536
- rows?: ?number,
537
-
538
- /**
539
- * When `false`, it will prevent the soft keyboard from showing when the field is focused.
540
- * Defaults to `true`.
541
- */
542
- showSoftInputOnFocus?: ?boolean,
543
-
544
- /**
545
- * Set text break strategy on Android API Level 23+, possible values are `simple`, `highQuality`, `balanced`
546
- * The default value is `simple`.
547
- * @platform android
548
- */
549
- textBreakStrategy?: ?('simple' | 'highQuality' | 'balanced'),
550
-
551
- /**
552
- * The color of the `TextInput` underline.
553
- * @platform android
554
- */
555
- underlineColorAndroid?: ?ColorValue,
556
- }>;
557
-
558
- // [Windows
559
-
560
- type SubmitKeyEvent = $ReadOnly<{|
561
- altKey?: ?boolean,
562
- ctrlKey?: ?boolean,
563
- metaKey?: ?boolean,
564
- shiftKey?: ?boolean,
565
- code: string,
566
- |}>;
567
-
568
- type TextInputWindowsProps = $ReadOnly<{|
569
- /**
570
- * If `true`, clears the text field synchronously before `onSubmitEditing` is emitted.
571
- * @platform windows
572
- */
573
- clearTextOnSubmit?: ?boolean,
574
-
575
- /**
576
- * Configures keys that can be used to submit editing for the TextInput.
577
- * @platform windows
578
- */
579
- submitKeyEvents?: ?$ReadOnlyArray<SubmitKeyEvent>,
580
- |}>;
581
-
582
- // Windows]
583
-
584
- type TextInputBaseProps = $ReadOnly<{
585
- /**
586
- * String to be read by screenreaders to indicate an error state. The acceptable parameters
587
- * of accessibilityErrorMessage is a string. Setting accessibilityInvalid to true activates
588
- * the error message. Setting accessibilityInvalid to false removes the error message.
589
- */
590
- accessibilityErrorMessage?: ?Stringish,
591
- accessibilityInvalid?: ?boolean,
592
-
593
- /**
594
- * Can tell `TextInput` to automatically capitalize certain characters.
595
- *
596
- * - `characters`: all characters.
597
- * - `words`: first letter of each word.
598
- * - `sentences`: first letter of each sentence (*default*).
599
- * - `none`: don't auto capitalize anything.
600
- */
601
- autoCapitalize?: ?AutoCapitalize,
602
-
603
- /**
604
- * Specifies autocomplete hints for the system, so it can provide autofill.
605
- * On Android, the system will always attempt to offer autofill by using heuristics to identify the type of content.
606
- * To disable autocomplete, set autoComplete to off.
607
- *
608
- * The following values work across platforms:
609
- *
610
- * - `additional-name`
611
- * - `address-line1`
612
- * - `address-line2`
613
- * - `birthdate-day` (iOS 17+)
614
- * - `birthdate-full` (iOS 17+)
615
- * - `birthdate-month` (iOS 17+)
616
- * - `birthdate-year` (iOS 17+)
617
- * - `cc-number`
618
- * - `cc-csc` (iOS 17+)
619
- * - `cc-exp` (iOS 17+)
620
- * - `cc-exp-day` (iOS 17+)
621
- * - `cc-exp-month` (iOS 17+)
622
- * - `cc-exp-year` (iOS 17+)
623
- * - `country`
624
- * - `current-password`
625
- * - `email`
626
- * - `family-name`
627
- * - `given-name`
628
- * - `honorific-prefix`
629
- * - `honorific-suffix`
630
- * - `name`
631
- * - `new-password`
632
- * - `off`
633
- * - `one-time-code`
634
- * - `postal-code`
635
- * - `street-address`
636
- * - `tel`
637
- * - `username`
638
- *
639
- * The following values work on iOS only:
640
- *
641
- * - `cc-name` (iOS 17+)
642
- * - `cc-given-name` (iOS 17+)
643
- * - `cc-middle-name` (iOS 17+)
644
- * - `cc-family-name` (iOS 17+)
645
- * - `cc-type` (iOS 17+)
646
- * - `nickname`
647
- * - `organization`
648
- * - `organization-title`
649
- * - `url`
650
- *
651
- * The following values work on Android only:
652
- *
653
- * - `gender`
654
- * - `name-family`
655
- * - `name-given`
656
- * - `name-middle`
657
- * - `name-middle-initial`
658
- * - `name-prefix`
659
- * - `name-suffix`
660
- * - `password`
661
- * - `password-new`
662
- * - `postal-address`
663
- * - `postal-address-country`
664
- * - `postal-address-extended`
665
- * - `postal-address-extended-postal-code`
666
- * - `postal-address-locality`
667
- * - `postal-address-region`
668
- * - `sms-otp`
669
- * - `tel-country-code`
670
- * - `tel-national`
671
- * - `tel-device`
672
- * - `username-new`
673
- */
674
- autoComplete?: ?(
675
- | 'additional-name'
676
- | 'address-line1'
677
- | 'address-line2'
678
- | 'birthdate-day'
679
- | 'birthdate-full'
680
- | 'birthdate-month'
681
- | 'birthdate-year'
682
- | 'cc-csc'
683
- | 'cc-exp'
684
- | 'cc-exp-day'
685
- | 'cc-exp-month'
686
- | 'cc-exp-year'
687
- | 'cc-number'
688
- | 'cc-name'
689
- | 'cc-given-name'
690
- | 'cc-middle-name'
691
- | 'cc-family-name'
692
- | 'cc-type'
693
- | 'country'
694
- | 'current-password'
695
- | 'email'
696
- | 'family-name'
697
- | 'gender'
698
- | 'given-name'
699
- | 'honorific-prefix'
700
- | 'honorific-suffix'
701
- | 'name'
702
- | 'name-family'
703
- | 'name-given'
704
- | 'name-middle'
705
- | 'name-middle-initial'
706
- | 'name-prefix'
707
- | 'name-suffix'
708
- | 'new-password'
709
- | 'nickname'
710
- | 'one-time-code'
711
- | 'organization'
712
- | 'organization-title'
713
- | 'password'
714
- | 'password-new'
715
- | 'postal-address'
716
- | 'postal-address-country'
717
- | 'postal-address-extended'
718
- | 'postal-address-extended-postal-code'
719
- | 'postal-address-locality'
720
- | 'postal-address-region'
721
- | 'postal-code'
722
- | 'street-address'
723
- | 'sms-otp'
724
- | 'tel'
725
- | 'tel-country-code'
726
- | 'tel-national'
727
- | 'tel-device'
728
- | 'url'
729
- | 'username'
730
- | 'username-new'
731
- | 'off'
732
- ),
733
-
734
- /**
735
- * If `false`, disables auto-correct. The default value is `true`.
736
- */
737
- autoCorrect?: ?boolean,
738
-
739
- /**
740
- * If `true`, focuses the input on `componentDidMount`.
741
- * The default value is `false`.
742
- */
743
- autoFocus?: ?boolean,
744
-
745
- /**
746
- * Specifies whether fonts should scale to respect Text Size accessibility settings. The
747
- * default is `true`.
748
- */
749
- allowFontScaling?: ?boolean,
750
-
751
- /**
752
- * If `true`, caret is hidden. The default value is `false`.
753
- *
754
- * On Android devices manufactured by Xiaomi with Android Q,
755
- * when keyboardType equals 'email-address'this will be set
756
- * in native to 'true' to prevent a system related crash. This
757
- * will cause cursor to be disabled as a side-effect.
758
- *
759
- */
760
- caretHidden?: ?boolean,
761
-
762
- /*
763
- * If `true`, contextMenuHidden is hidden. The default value is `false`.
764
- */
765
- contextMenuHidden?: ?boolean,
766
-
767
- /**
768
- * Provides an initial value that will change when the user starts typing.
769
- * Useful for simple use-cases where you do not want to deal with listening
770
- * to events and updating the value prop to keep the controlled state in sync.
771
- */
772
- defaultValue?: ?Stringish,
773
-
774
- /**
775
- * If `false`, text is not editable. The default value is `true`.
776
- */
777
- editable?: ?boolean,
778
-
779
- forwardedRef?: ?React.RefSetter<TextInputInstance>,
780
-
781
- /**
782
- * `enterKeyHint` defines what action label (or icon) to present for the enter key on virtual keyboards.
783
- *
784
- * The following values is supported:
785
- *
786
- * - `enter`
787
- * - `done`
788
- * - `go`
789
- * - `next`
790
- * - `previous`
791
- * - `search`
792
- * - `send`
793
- */
794
- enterKeyHint?: ?EnterKeyHintTypeOptions,
795
-
796
- /**
797
- * `inputMode` works like the `inputmode` attribute in HTML, it determines which
798
- * keyboard to open, e.g.`numeric` and has precedence over keyboardType
799
- *
800
- * Support the following values:
801
- *
802
- * - `none`
803
- * - `text`
804
- * - `decimal`
805
- * - `numeric`
806
- * - `tel`
807
- * - `search`
808
- * - `email`
809
- * - `url`
810
- */
811
- inputMode?: ?InputModeOptions,
812
-
813
- /**
814
- * Determines which keyboard to open, e.g.`numeric`.
815
- *
816
- * The following values work across platforms:
817
- *
818
- * - `default`
819
- * - `numeric`
820
- * - `number-pad`
821
- * - `decimal-pad`
822
- * - `email-address`
823
- * - `phone-pad`
824
- * - `url`
825
- *
826
- * *iOS Only*
827
- *
828
- * The following values work on iOS only:
829
- *
830
- * - `ascii-capable`
831
- * - `numbers-and-punctuation`
832
- * - `name-phone-pad`
833
- * - `twitter`
834
- * - `web-search`
835
- *
836
- * *Android Only*
837
- *
838
- * The following values work on Android only:
839
- *
840
- * - `visible-password`
841
- *
842
- */
843
- keyboardType?: ?KeyboardTypeOptions,
844
-
845
- /**
846
- * Specifies largest possible scale a font can reach when `allowFontScaling` is enabled.
847
- * Possible values:
848
- * `null/undefined` (default): inherit from the parent node or the global default (0)
849
- * `0`: no max, ignore parent/global default
850
- * `>= 1`: sets the maxFontSizeMultiplier of this node to this value
851
- */
852
- maxFontSizeMultiplier?: ?number,
853
-
854
- /**
855
- * Limits the maximum number of characters that can be entered. Use this
856
- * instead of implementing the logic in JS to avoid flicker.
857
- */
858
- maxLength?: ?number,
859
-
860
- /**
861
- * If `true`, the text input can be multiple lines.
862
- * The default value is `false`.
863
- */
864
- multiline?: ?boolean,
865
-
866
- /**
867
- * Callback that is called when the text input is blurred.
868
- */
869
- onBlur?: ?(e: TextInputBlurEvent) => mixed,
870
-
871
- /**
872
- * Callback that is called when the text input's text changes.
873
- */
874
- onChange?: ?(e: TextInputChangeEvent) => mixed,
875
-
876
- /**
877
- * Callback that is called when the text input's text changes.
878
- * Changed text is passed as an argument to the callback handler.
879
- */
880
- onChangeText?: ?(text: string) => mixed,
881
-
882
- /**
883
- * Callback that is called when the text input's content size changes.
884
- * This will be called with
885
- * `{ nativeEvent: { contentSize: { width, height } } }`.
886
- *
887
- * Only called for multiline text inputs.
888
- */
889
- onContentSizeChange?: ?(e: TextInputContentSizeChangeEvent) => mixed,
890
-
891
- /**
892
- * Callback that is called when text input ends.
893
- */
894
- onEndEditing?: ?(e: TextInputEndEditingEvent) => mixed,
895
-
896
- /**
897
- * Callback that is called when the text input is focused.
898
- */
899
- onFocus?: ?(e: TextInputFocusEvent) => mixed,
900
-
901
- /**
902
- * Callback that is called when a key is pressed.
903
- * This will be called with `{ nativeEvent: { key: keyValue } }`
904
- * where `keyValue` is `'Enter'` or `'Backspace'` for respective keys and
905
- * the typed-in character otherwise including `' '` for space.
906
- * Fires before `onChange` callbacks.
907
- */
908
- onKeyPress?: ?(e: TextInputKeyPressEvent) => mixed,
909
-
910
- /**
911
- * Called when a single tap gesture is detected.
912
- */
913
- onPress?: ?(event: GestureResponderEvent) => mixed,
914
-
915
- /**
916
- * Called when a touch is engaged.
917
- */
918
- onPressIn?: ?(event: GestureResponderEvent) => mixed,
919
-
920
- /**
921
- * Called when a touch is released.
922
- */
923
- onPressOut?: ?(event: GestureResponderEvent) => mixed,
924
-
925
- /**
926
- * Callback that is called when the text input selection is changed.
927
- * This will be called with
928
- * `{ nativeEvent: { selection: { start, end } } }`.
929
- */
930
- onSelectionChange?: ?(e: TextInputSelectionChangeEvent) => mixed,
931
-
932
- /**
933
- * Callback that is called when the text input's submit button is pressed.
934
- * Invalid if `multiline={true}` is specified.
935
- */
936
- onSubmitEditing?: ?(e: TextInputSubmitEditingEvent) => mixed,
937
-
938
- /**
939
- * Invoked on content scroll with `{ nativeEvent: { contentOffset: { x, y } } }`.
940
- * May also contain other properties from ScrollEvent but on Android contentSize
941
- * is not provided for performance reasons.
942
- */
943
- onScroll?: ?(e: ScrollEvent) => mixed,
944
-
945
- /**
946
- * The string that will be rendered before text input has been entered.
947
- */
948
- placeholder?: ?Stringish,
949
-
950
- /**
951
- * The text color of the placeholder string.
952
- */
953
- placeholderTextColor?: ?ColorValue,
954
-
955
- /** `readOnly` works like the `readonly` attribute in HTML.
956
- * If `true`, text is not editable. The default value is `false`.
957
- * See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly
958
- * for more details.
959
- */
960
- readOnly?: ?boolean,
961
-
962
- /**
963
- * Determines how the return key should look. On Android you can also use
964
- * `returnKeyLabel`.
965
- *
966
- * *Cross platform*
967
- *
968
- * The following values work across platforms:
969
- *
970
- * - `done`
971
- * - `go`
972
- * - `next`
973
- * - `search`
974
- * - `send`
975
- *
976
- * *Android Only*
977
- *
978
- * The following values work on Android only:
979
- *
980
- * - `none`
981
- * - `previous`
982
- *
983
- * *iOS Only*
984
- *
985
- * The following values work on iOS only:
986
- *
987
- * - `default`
988
- * - `emergency-call`
989
- * - `google`
990
- * - `join`
991
- * - `route`
992
- * - `yahoo`
993
- */
994
- returnKeyType?: ?ReturnKeyTypeOptions,
995
-
996
- /**
997
- * If `true`, the text input obscures the text entered so that sensitive text
998
- * like passwords stay secure. The default value is `false`. Does not work with 'multiline={true}'.
999
- */
1000
- secureTextEntry?: ?boolean,
1001
-
1002
- /**
1003
- * The start and end of the text input's selection. Set start and end to
1004
- * the same value to position the cursor.
1005
- */
1006
- selection?: ?$ReadOnly<{
1007
- start: number,
1008
- end?: ?number,
1009
- }>,
1010
-
1011
- /**
1012
- * The highlight and cursor color of the text input.
1013
- */
1014
- selectionColor?: ?ColorValue,
1015
-
1016
- /**
1017
- * When provided it will set the color of the selection handles when highlighting text.
1018
- * Unlike the behavior of `selectionColor` the handle color will be set independently
1019
- * from the color of the text selection box.
1020
- * @platform android
1021
- */
1022
- selectionHandleColor?: ?ColorValue,
1023
-
1024
- /**
1025
- * If `true`, all text will automatically be selected on focus.
1026
- */
1027
- selectTextOnFocus?: ?boolean,
1028
-
1029
- /**
1030
- * If `true`, the text field will blur when submitted.
1031
- * The default value is true for single-line fields and false for
1032
- * multiline fields. Note that for multiline fields, setting `blurOnSubmit`
1033
- * to `true` means that pressing return will blur the field and trigger the
1034
- * `onSubmitEditing` event instead of inserting a newline into the field.
1035
- *
1036
- * @deprecated
1037
- * Note that `submitBehavior` now takes the place of `blurOnSubmit` and will
1038
- * override any behavior defined by `blurOnSubmit`.
1039
- * @see submitBehavior
1040
- */
1041
- blurOnSubmit?: ?boolean,
1042
-
1043
- /**
1044
- * When the return key is pressed,
1045
- *
1046
- * For single line inputs:
1047
- *
1048
- * - `'newline`' defaults to `'blurAndSubmit'`
1049
- * - `undefined` defaults to `'blurAndSubmit'`
1050
- *
1051
- * For multiline inputs:
1052
- *
1053
- * - `'newline'` adds a newline
1054
- * - `undefined` defaults to `'newline'`
1055
- *
1056
- * For both single line and multiline inputs:
1057
- *
1058
- * - `'submit'` will only send a submit event and not blur the input
1059
- * - `'blurAndSubmit`' will both blur the input and send a submit event
1060
- */
1061
- submitBehavior?: ?SubmitBehavior,
1062
-
1063
- /**
1064
- * Note that not all Text styles are supported, an incomplete list of what is not supported includes:
1065
- *
1066
- * - `borderLeftWidth`
1067
- * - `borderTopWidth`
1068
- * - `borderRightWidth`
1069
- * - `borderBottomWidth`
1070
- * - `borderTopLeftRadius`
1071
- * - `borderTopRightRadius`
1072
- * - `borderBottomRightRadius`
1073
- * - `borderBottomLeftRadius`
1074
- *
1075
- * see [Issue#7070](https://github.com/facebook/react-native/issues/7070)
1076
- * for more detail.
1077
- *
1078
- * [Styles](docs/style.html)
1079
- */
1080
- style?: ?TextStyleProp,
1081
-
1082
- /**
1083
- * The value to show for the text input. `TextInput` is a controlled
1084
- * component, which means the native value will be forced to match this
1085
- * value prop if provided. For most uses, this works great, but in some
1086
- * cases this may cause flickering - one common cause is preventing edits
1087
- * by keeping value the same. In addition to simply setting the same value,
1088
- * either set `editable={false}`, or set/update `maxLength` to prevent
1089
- * unwanted edits without flicker.
1090
- */
1091
- value?: ?Stringish,
1092
- }>;
1093
-
1094
- export type TextInputProps = $ReadOnly<{
1095
- ...$Diff<ViewProps, $ReadOnly<{style: ?ViewStyleProp}>>,
1096
- ...TextInputIOSProps,
1097
- ...TextInputAndroidProps,
1098
- ...TextInputBaseProps,
1099
- ...TextInputWindowsProps, // [Windows]
1100
- }>;
1101
-
1102
132
  type TextInputStateType = $ReadOnly<{
1103
133
  /**
1104
134
  * @deprecated Use currentlyFocusedInput