@office-iss/react-native-win32 0.79.0-preview.2 → 0.80.0-preview.1

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