@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
@@ -12,20 +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
- import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags';
22
53
  import usePressability from '../../Pressability/usePressability';
23
54
  import flattenStyle from '../../StyleSheet/flattenStyle';
24
- import StyleSheet, {
25
- type ColorValue,
26
- type TextStyleProp,
27
- type ViewStyleProp,
28
- } from '../../StyleSheet/StyleSheet';
55
+ import StyleSheet, {type TextStyleProp} from '../../StyleSheet/StyleSheet';
29
56
  import Text from '../../Text/Text';
30
57
  import TextAncestor from '../../Text/TextAncestor';
31
58
  import Platform from '../../Utilities/Platform';
@@ -69,968 +96,66 @@ else if (Platform.OS === 'win32') {
69
96
  }
70
97
  // Windows]
71
98
 
72
- export type TextInputChangeEventData = $ReadOnly<{
73
- eventCount: number,
74
- target: number,
75
- text: string,
76
- }>;
77
-
78
- export type TextInputChangeEvent =
79
- NativeSyntheticEvent<TextInputChangeEventData>;
80
-
81
- export type TextInputEvent = NativeSyntheticEvent<
82
- $ReadOnly<{
83
- eventCount: number,
84
- previousText: string,
85
- range: $ReadOnly<{
86
- start: number,
87
- end: number,
88
- }>,
89
- target: number,
90
- text: string,
91
- }>,
92
- >;
93
-
94
- export type TextInputContentSizeChangeEventData = $ReadOnly<{
95
- target: number,
96
- contentSize: $ReadOnly<{
97
- width: number,
98
- height: number,
99
- }>,
100
- }>;
101
-
102
- export type TextInputContentSizeChangeEvent =
103
- NativeSyntheticEvent<TextInputContentSizeChangeEventData>;
104
-
105
- export type TargetEvent = $ReadOnly<{
106
- target: number,
107
- }>;
108
-
109
- export type TextInputFocusEventData = TargetEvent;
110
-
111
- export type TextInputBlurEvent = NativeSyntheticEvent<TextInputFocusEventData>;
112
- export type TextInputFocusEvent = NativeSyntheticEvent<TextInputFocusEventData>;
113
-
114
- type Selection = $ReadOnly<{
115
- start: number,
116
- end: number,
117
- }>;
118
-
119
- export type TextInputSelectionChangeEventData = $ReadOnly<{
120
- ...TargetEvent,
121
- selection: Selection,
122
- }>;
123
-
124
- export type TextInputSelectionChangeEvent =
125
- NativeSyntheticEvent<TextInputSelectionChangeEventData>;
126
-
127
- type TextInputKeyPressEventData = $ReadOnly<{
128
- ...TargetEvent,
129
- key: string,
130
- target?: ?number,
131
- eventCount?: ?number,
132
- }>;
133
-
134
- export type TextInputKeyPressEvent =
135
- NativeSyntheticEvent<TextInputKeyPressEventData>;
136
-
137
- export type TextInputEndEditingEventData = $ReadOnly<{
138
- ...TargetEvent,
139
- eventCount: number,
140
- text: string,
141
- }>;
142
-
143
- export type TextInputEditingEvent =
144
- NativeSyntheticEvent<TextInputEndEditingEventData>;
145
-
146
- type DataDetectorTypesType =
147
- | 'phoneNumber'
148
- | 'link'
149
- | 'address'
150
- | 'calendarEvent'
151
- | 'trackingNumber'
152
- | 'flightNumber'
153
- | 'lookupSuggestion'
154
- | 'none'
155
- | 'all';
156
-
157
- export type KeyboardType =
158
- | 'default'
159
- | 'email-address'
160
- | 'numeric'
161
- | 'phone-pad'
162
- | 'number-pad'
163
- | 'decimal-pad'
164
- | 'url';
165
-
166
- export type KeyboardTypeIOS =
167
- | 'ascii-capable'
168
- | 'numbers-and-punctuation'
169
- | 'name-phone-pad'
170
- | 'twitter'
171
- | 'web-search'
172
- // iOS 10+ only
173
- | 'ascii-capable-number-pad';
174
-
175
- export type KeyboardTypeAndroid = 'visible-password';
176
-
177
- export type KeyboardTypeOptions =
178
- | KeyboardType
179
- | KeyboardTypeIOS
180
- | KeyboardTypeAndroid;
181
-
182
- export type InputModeOptions =
183
- | 'none'
184
- | 'text'
185
- | 'decimal'
186
- | 'numeric'
187
- | 'tel'
188
- | 'search'
189
- | 'email'
190
- | 'url';
191
-
192
- export type ReturnKeyType = 'done' | 'go' | 'next' | 'search' | 'send';
193
-
194
- export type ReturnKeyTypeIOS =
195
- | 'default'
196
- | 'emergency-call'
197
- | 'google'
198
- | 'join'
199
- | 'route'
200
- | 'yahoo';
201
-
202
- export type ReturnKeyTypeAndroid = 'none' | 'previous';
203
-
204
- export type ReturnKeyTypeOptions =
205
- | ReturnKeyType
206
- | ReturnKeyTypeIOS
207
- | ReturnKeyTypeAndroid;
208
-
209
- export type SubmitBehavior = 'submit' | 'blurAndSubmit' | 'newline';
210
-
211
- export type AutoCapitalize = 'none' | 'sentences' | 'words' | 'characters';
212
-
213
- export type TextContentType =
214
- | 'none'
215
- | 'URL'
216
- | 'addressCity'
217
- | 'addressCityAndState'
218
- | 'addressState'
219
- | 'countryName'
220
- | 'creditCardNumber'
221
- | 'creditCardExpiration'
222
- | 'creditCardExpirationMonth'
223
- | 'creditCardExpirationYear'
224
- | 'creditCardSecurityCode'
225
- | 'creditCardType'
226
- | 'creditCardName'
227
- | 'creditCardGivenName'
228
- | 'creditCardMiddleName'
229
- | 'creditCardFamilyName'
230
- | 'emailAddress'
231
- | 'familyName'
232
- | 'fullStreetAddress'
233
- | 'givenName'
234
- | 'jobTitle'
235
- | 'location'
236
- | 'middleName'
237
- | 'name'
238
- | 'namePrefix'
239
- | 'nameSuffix'
240
- | 'nickname'
241
- | 'organizationName'
242
- | 'postalCode'
243
- | 'streetAddressLine1'
244
- | 'streetAddressLine2'
245
- | 'sublocality'
246
- | 'telephoneNumber'
247
- | 'username'
248
- | 'password'
249
- | 'newPassword'
250
- | 'oneTimeCode'
251
- | 'birthdate'
252
- | 'birthdateDay'
253
- | 'birthdateMonth'
254
- | 'birthdateYear'
255
- | 'cellularEID'
256
- | 'cellularIMEI'
257
- | 'dateTime'
258
- | 'flightNumber'
259
- | 'shipmentTrackingNumber';
260
-
261
- export type EnterKeyHintTypeAndroid = 'previous';
262
-
263
- export type EnterKeyHintTypeIOS = 'enter';
264
-
265
- export type EnterKeyHintType = 'done' | 'go' | 'next' | 'search' | 'send';
266
-
267
- export type EnterKeyHintTypeOptions =
268
- | EnterKeyHintType
269
- | EnterKeyHintTypeAndroid
270
- | EnterKeyHintTypeIOS;
271
-
272
- type PasswordRules = string;
273
-
274
- export type TextInputIOSProps = $ReadOnly<{
275
- /**
276
- * If true, the keyboard shortcuts (undo/redo and copy buttons) are disabled. The default value is false.
277
- * @platform ios
278
- */
279
- disableKeyboardShortcuts?: ?boolean,
280
-
281
- /**
282
- * When the clear button should appear on the right side of the text view.
283
- * This property is supported only for single-line TextInput component.
284
- * @platform ios
285
- */
286
- clearButtonMode?: ?('never' | 'while-editing' | 'unless-editing' | 'always'),
287
-
288
- /**
289
- * If `true`, clears the text field automatically when editing begins.
290
- * @platform ios
291
- */
292
- clearTextOnFocus?: ?boolean,
293
-
294
- /**
295
- * Determines the types of data converted to clickable URLs in the text input.
296
- * Only valid if `multiline={true}` and `editable={false}`.
297
- * By default no data types are detected.
298
- *
299
- * You can provide one type or an array of many types.
300
- *
301
- * Possible values for `dataDetectorTypes` are:
302
- *
303
- * - `'phoneNumber'`
304
- * - `'link'`
305
- * - `'address'`
306
- * - `'calendarEvent'`
307
- * - `'none'`
308
- * - `'all'`
309
- *
310
- * @platform ios
311
- */
312
- dataDetectorTypes?:
313
- | ?DataDetectorTypesType
314
- | $ReadOnlyArray<DataDetectorTypesType>,
315
-
316
- /**
317
- * If `true`, the keyboard disables the return key when there is no text and
318
- * automatically enables it when there is text. The default value is `false`.
319
- * @platform ios
320
- */
321
- enablesReturnKeyAutomatically?: ?boolean,
322
-
323
- /**
324
- * An optional identifier which links a custom InputAccessoryView to
325
- * this text input. The InputAccessoryView is rendered above the
326
- * keyboard when this text input is focused.
327
- * @platform ios
328
- */
329
- inputAccessoryViewID?: ?string,
330
-
331
- /**
332
- * An optional label that overrides the default input accessory view button label.
333
- * @platform ios
334
- */
335
- inputAccessoryViewButtonLabel?: ?string,
336
-
337
- /**
338
- * Determines the color of the keyboard.
339
- * @platform ios
340
- */
341
- keyboardAppearance?: ?('default' | 'light' | 'dark'),
342
-
343
- /**
344
- * Provide rules for your password.
345
- * 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.
346
- * "required: upper; required: lower; required: digit; max-consecutive: 2; minlength: 8;"
347
- * @platform ios
348
- */
349
- passwordRules?: ?PasswordRules,
350
-
351
- /*
352
- * If `true`, allows TextInput to pass touch events to the parent component.
353
- * This allows components to be swipeable from the TextInput on iOS,
354
- * as is the case on Android by default.
355
- * If `false`, TextInput always asks to handle the input (except when disabled).
356
- * @platform ios
357
- */
358
- rejectResponderTermination?: ?boolean,
359
-
360
- /**
361
- * If `false`, scrolling of the text view will be disabled.
362
- * The default value is `true`. Does only work with 'multiline={true}'.
363
- * @platform ios
364
- */
365
- scrollEnabled?: ?boolean,
366
-
367
- /**
368
- * If `false`, disables spell-check style (i.e. red underlines).
369
- * The default value is inherited from `autoCorrect`.
370
- * @platform ios
371
- */
372
- spellCheck?: ?boolean,
373
-
374
- /**
375
- * Give the keyboard and the system information about the
376
- * expected semantic meaning for the content that users enter.
377
- * @platform ios
378
- */
379
- textContentType?: ?TextContentType,
380
-
381
- /**
382
- * Set line break strategy on iOS.
383
- * @platform ios
384
- */
385
- lineBreakStrategyIOS?: ?('none' | 'standard' | 'hangul-word' | 'push-out'),
386
-
387
- /**
388
- * Set line break mode on iOS.
389
- * @platform ios
390
- */
391
- lineBreakModeIOS?: ?(
392
- | 'wordWrapping'
393
- | 'char'
394
- | 'clip'
395
- | 'head'
396
- | 'middle'
397
- | 'tail'
398
- ),
399
-
400
- /**
401
- * If `false`, the iOS system will not insert an extra space after a paste operation
402
- * neither delete one or two spaces after a cut or delete operation.
403
- *
404
- * The default value is `true`.
405
- *
406
- * @platform ios
407
- */
408
- smartInsertDelete?: ?boolean,
409
- }>;
410
-
411
- export type TextInputAndroidProps = $ReadOnly<{
412
- /**
413
- * When provided it will set the color of the cursor (or "caret") in the component.
414
- * Unlike the behavior of `selectionColor` the cursor color will be set independently
415
- * from the color of the text selection box.
416
- * @platform android
417
- */
418
- cursorColor?: ?ColorValue,
419
-
420
- /**
421
- * When `false`, if there is a small amount of space available around a text input
422
- * (e.g. landscape orientation on a phone), the OS may choose to have the user edit
423
- * the text inside of a full screen text input mode. When `true`, this feature is
424
- * disabled and users will always edit the text directly inside of the text input.
425
- * Defaults to `false`.
426
- * @platform android
427
- */
428
- disableFullscreenUI?: ?boolean,
429
-
430
- importantForAutofill?: ?(
431
- | 'auto'
432
- | 'no'
433
- | 'noExcludeDescendants'
434
- | 'yes'
435
- | 'yesExcludeDescendants'
436
- ),
437
-
438
- /**
439
- * If defined, the provided image resource will be rendered on the left.
440
- * The image resource must be inside `/android/app/src/main/res/drawable` and referenced
441
- * like
442
- * ```
443
- * <TextInput
444
- * inlineImageLeft='search_icon'
445
- * />
446
- * ```
447
- * @platform android
448
- */
449
- inlineImageLeft?: ?string,
450
-
451
- /**
452
- * Padding between the inline image, if any, and the text input itself.
453
- * @platform android
454
- */
455
- inlineImagePadding?: ?number,
456
-
457
- /**
458
- * Sets the number of lines for a `TextInput`. Use it with multiline set to
459
- * `true` to be able to fill the lines.
460
- * @platform android
461
- */
462
- numberOfLines?: ?number,
463
-
464
- /**
465
- * Sets the return key to the label. Use it instead of `returnKeyType`.
466
- * @platform android
467
- */
468
- returnKeyLabel?: ?string,
469
-
470
- /**
471
- * Sets the number of rows for a `TextInput`. Use it with multiline set to
472
- * `true` to be able to fill the lines.
473
- * @platform android
474
- */
475
- rows?: ?number,
476
-
477
- /**
478
- * When `false`, it will prevent the soft keyboard from showing when the field is focused.
479
- * Defaults to `true`.
480
- */
481
- showSoftInputOnFocus?: ?boolean,
482
-
483
- /**
484
- * Set text break strategy on Android API Level 23+, possible values are `simple`, `highQuality`, `balanced`
485
- * The default value is `simple`.
486
- * @platform android
487
- */
488
- textBreakStrategy?: ?('simple' | 'highQuality' | 'balanced'),
489
-
490
- /**
491
- * The color of the `TextInput` underline.
492
- * @platform android
493
- */
494
- underlineColorAndroid?: ?ColorValue,
495
- }>;
496
-
497
- // [Windows
498
-
499
- type SubmitKeyEvent = $ReadOnly<{|
500
- altKey?: ?boolean,
501
- ctrlKey?: ?boolean,
502
- metaKey?: ?boolean,
503
- shiftKey?: ?boolean,
504
- code: string,
505
- |}>;
506
-
507
- type TextInputWindowsProps = $ReadOnly<{|
508
- /**
509
- * If `true`, clears the text field synchronously before `onSubmitEditing` is emitted.
510
- * @platform windows
511
- */
512
- clearTextOnSubmit?: ?boolean,
513
-
514
- /**
515
- * Configures keys that can be used to submit editing for the TextInput.
516
- * @platform windows
517
- */
518
- submitKeyEvents?: ?$ReadOnlyArray<SubmitKeyEvent>,
519
- |}>;
520
-
521
- // Windows]
522
-
523
- export type TextInputProps = $ReadOnly<{
524
- ...$Diff<ViewProps, $ReadOnly<{style: ?ViewStyleProp}>>,
525
- ...TextInputIOSProps,
526
- ...TextInputAndroidProps,
527
- ...TextInputWindowsProps, // [Windows]
528
-
529
- /**
530
- * String to be read by screenreaders to indicate an error state. The acceptable parameters
531
- * of accessibilityErrorMessage is a string. Setting accessibilityInvalid to true activates
532
- * the error message. Setting accessibilityInvalid to false removes the error message.
533
- */
534
- accessibilityErrorMessage?: ?Stringish,
535
- accessibilityInvalid?: ?boolean,
536
-
537
- /**
538
- * Can tell `TextInput` to automatically capitalize certain characters.
539
- *
540
- * - `characters`: all characters.
541
- * - `words`: first letter of each word.
542
- * - `sentences`: first letter of each sentence (*default*).
543
- * - `none`: don't auto capitalize anything.
544
- */
545
- autoCapitalize?: ?AutoCapitalize,
546
-
547
- /**
548
- * Specifies autocomplete hints for the system, so it can provide autofill.
549
- * On Android, the system will always attempt to offer autofill by using heuristics to identify the type of content.
550
- * To disable autocomplete, set autoComplete to off.
551
- *
552
- * The following values work across platforms:
553
- *
554
- * - `additional-name`
555
- * - `address-line1`
556
- * - `address-line2`
557
- * - `birthdate-day` (iOS 17+)
558
- * - `birthdate-full` (iOS 17+)
559
- * - `birthdate-month` (iOS 17+)
560
- * - `birthdate-year` (iOS 17+)
561
- * - `cc-number`
562
- * - `cc-csc` (iOS 17+)
563
- * - `cc-exp` (iOS 17+)
564
- * - `cc-exp-day` (iOS 17+)
565
- * - `cc-exp-month` (iOS 17+)
566
- * - `cc-exp-year` (iOS 17+)
567
- * - `country`
568
- * - `current-password`
569
- * - `email`
570
- * - `family-name`
571
- * - `given-name`
572
- * - `honorific-prefix`
573
- * - `honorific-suffix`
574
- * - `name`
575
- * - `new-password`
576
- * - `off`
577
- * - `one-time-code`
578
- * - `postal-code`
579
- * - `street-address`
580
- * - `tel`
581
- * - `username`
582
- *
583
- * The following values work on iOS only:
584
- *
585
- * - `cc-name` (iOS 17+)
586
- * - `cc-given-name` (iOS 17+)
587
- * - `cc-middle-name` (iOS 17+)
588
- * - `cc-family-name` (iOS 17+)
589
- * - `cc-type` (iOS 17+)
590
- * - `nickname`
591
- * - `organization`
592
- * - `organization-title`
593
- * - `url`
594
- *
595
- * The following values work on Android only:
596
- *
597
- * - `gender`
598
- * - `name-family`
599
- * - `name-given`
600
- * - `name-middle`
601
- * - `name-middle-initial`
602
- * - `name-prefix`
603
- * - `name-suffix`
604
- * - `password`
605
- * - `password-new`
606
- * - `postal-address`
607
- * - `postal-address-country`
608
- * - `postal-address-extended`
609
- * - `postal-address-extended-postal-code`
610
- * - `postal-address-locality`
611
- * - `postal-address-region`
612
- * - `sms-otp`
613
- * - `tel-country-code`
614
- * - `tel-national`
615
- * - `tel-device`
616
- * - `username-new`
617
- */
618
- autoComplete?: ?(
619
- | 'additional-name'
620
- | 'address-line1'
621
- | 'address-line2'
622
- | 'birthdate-day'
623
- | 'birthdate-full'
624
- | 'birthdate-month'
625
- | 'birthdate-year'
626
- | 'cc-csc'
627
- | 'cc-exp'
628
- | 'cc-exp-day'
629
- | 'cc-exp-month'
630
- | 'cc-exp-year'
631
- | 'cc-number'
632
- | 'cc-name'
633
- | 'cc-given-name'
634
- | 'cc-middle-name'
635
- | 'cc-family-name'
636
- | 'cc-type'
637
- | 'country'
638
- | 'current-password'
639
- | 'email'
640
- | 'family-name'
641
- | 'gender'
642
- | 'given-name'
643
- | 'honorific-prefix'
644
- | 'honorific-suffix'
645
- | 'name'
646
- | 'name-family'
647
- | 'name-given'
648
- | 'name-middle'
649
- | 'name-middle-initial'
650
- | 'name-prefix'
651
- | 'name-suffix'
652
- | 'new-password'
653
- | 'nickname'
654
- | 'one-time-code'
655
- | 'organization'
656
- | 'organization-title'
657
- | 'password'
658
- | 'password-new'
659
- | 'postal-address'
660
- | 'postal-address-country'
661
- | 'postal-address-extended'
662
- | 'postal-address-extended-postal-code'
663
- | 'postal-address-locality'
664
- | 'postal-address-region'
665
- | 'postal-code'
666
- | 'street-address'
667
- | 'sms-otp'
668
- | 'tel'
669
- | 'tel-country-code'
670
- | 'tel-national'
671
- | 'tel-device'
672
- | 'url'
673
- | 'username'
674
- | 'username-new'
675
- | 'off'
676
- ),
677
-
678
- /**
679
- * If `false`, disables auto-correct. The default value is `true`.
680
- */
681
- autoCorrect?: ?boolean,
682
-
683
- /**
684
- * If `true`, focuses the input on `componentDidMount`.
685
- * The default value is `false`.
686
- */
687
- autoFocus?: ?boolean,
688
-
689
- /**
690
- * Specifies whether fonts should scale to respect Text Size accessibility settings. The
691
- * default is `true`.
692
- */
693
- allowFontScaling?: ?boolean,
694
-
695
- /**
696
- * If `true`, caret is hidden. The default value is `false`.
697
- *
698
- * On Android devices manufactured by Xiaomi with Android Q,
699
- * when keyboardType equals 'email-address'this will be set
700
- * in native to 'true' to prevent a system related crash. This
701
- * will cause cursor to be disabled as a side-effect.
702
- *
703
- */
704
- caretHidden?: ?boolean,
705
-
706
- /*
707
- * If `true`, contextMenuHidden is hidden. The default value is `false`.
708
- */
709
- contextMenuHidden?: ?boolean,
710
-
711
- /**
712
- * Provides an initial value that will change when the user starts typing.
713
- * Useful for simple use-cases where you do not want to deal with listening
714
- * to events and updating the value prop to keep the controlled state in sync.
715
- */
716
- defaultValue?: ?Stringish,
717
-
718
- /**
719
- * If `false`, text is not editable. The default value is `true`.
720
- */
721
- editable?: ?boolean,
722
-
723
- forwardedRef?: ?React.RefSetter<TextInputInstance>,
724
-
725
- /**
726
- * `enterKeyHint` defines what action label (or icon) to present for the enter key on virtual keyboards.
727
- *
728
- * The following values is supported:
729
- *
730
- * - `enter`
731
- * - `done`
732
- * - `go`
733
- * - `next`
734
- * - `previous`
735
- * - `search`
736
- * - `send`
737
- */
738
- enterKeyHint?: ?EnterKeyHintTypeOptions,
739
-
740
- /**
741
- * `inputMode` works like the `inputmode` attribute in HTML, it determines which
742
- * keyboard to open, e.g.`numeric` and has precedence over keyboardType
743
- *
744
- * Support the following values:
745
- *
746
- * - `none`
747
- * - `text`
748
- * - `decimal`
749
- * - `numeric`
750
- * - `tel`
751
- * - `search`
752
- * - `email`
753
- * - `url`
754
- */
755
- inputMode?: ?InputModeOptions,
756
-
757
- /**
758
- * Determines which keyboard to open, e.g.`numeric`.
759
- *
760
- * The following values work across platforms:
761
- *
762
- * - `default`
763
- * - `numeric`
764
- * - `number-pad`
765
- * - `decimal-pad`
766
- * - `email-address`
767
- * - `phone-pad`
768
- * - `url`
769
- *
770
- * *iOS Only*
771
- *
772
- * The following values work on iOS only:
773
- *
774
- * - `ascii-capable`
775
- * - `numbers-and-punctuation`
776
- * - `name-phone-pad`
777
- * - `twitter`
778
- * - `web-search`
779
- *
780
- * *Android Only*
781
- *
782
- * The following values work on Android only:
783
- *
784
- * - `visible-password`
785
- *
786
- */
787
- keyboardType?: ?KeyboardTypeOptions,
788
-
789
- /**
790
- * Specifies largest possible scale a font can reach when `allowFontScaling` is enabled.
791
- * Possible values:
792
- * `null/undefined` (default): inherit from the parent node or the global default (0)
793
- * `0`: no max, ignore parent/global default
794
- * `>= 1`: sets the maxFontSizeMultiplier of this node to this value
795
- */
796
- maxFontSizeMultiplier?: ?number,
797
-
798
- /**
799
- * Limits the maximum number of characters that can be entered. Use this
800
- * instead of implementing the logic in JS to avoid flicker.
801
- */
802
- maxLength?: ?number,
803
-
804
- /**
805
- * If `true`, the text input can be multiple lines.
806
- * The default value is `false`.
807
- */
808
- multiline?: ?boolean,
809
-
810
- /**
811
- * Callback that is called when the text input is blurred.
812
- */
813
- onBlur?: ?(e: TextInputBlurEvent) => mixed,
814
-
815
- /**
816
- * Callback that is called when the text input's text changes.
817
- */
818
- onChange?: ?(e: TextInputChangeEvent) => mixed,
819
-
820
- /**
821
- * Callback that is called when the text input's text changes.
822
- * Changed text is passed as an argument to the callback handler.
823
- */
824
- onChangeText?: ?(text: string) => mixed,
825
-
826
- /**
827
- * Callback that is called when the text input's content size changes.
828
- * This will be called with
829
- * `{ nativeEvent: { contentSize: { width, height } } }`.
830
- *
831
- * Only called for multiline text inputs.
832
- */
833
- onContentSizeChange?: ?(e: TextInputContentSizeChangeEvent) => mixed,
834
-
835
- /**
836
- * Callback that is called when text input ends.
837
- */
838
- onEndEditing?: ?(e: TextInputEditingEvent) => mixed,
839
-
840
- /**
841
- * Callback that is called when the text input is focused.
842
- */
843
- onFocus?: ?(e: TextInputFocusEvent) => mixed,
844
-
845
- /**
846
- * Callback that is called when a key is pressed.
847
- * This will be called with `{ nativeEvent: { key: keyValue } }`
848
- * where `keyValue` is `'Enter'` or `'Backspace'` for respective keys and
849
- * the typed-in character otherwise including `' '` for space.
850
- * Fires before `onChange` callbacks.
851
- */
852
- onKeyPress?: ?(e: TextInputKeyPressEvent) => mixed,
853
-
854
- /**
855
- * Called when a single tap gesture is detected.
856
- */
857
- onPress?: ?(event: GestureResponderEvent) => mixed,
858
-
859
- /**
860
- * Called when a touch is engaged.
861
- */
862
- onPressIn?: ?(event: GestureResponderEvent) => mixed,
863
-
864
- /**
865
- * Called when a touch is released.
866
- */
867
- onPressOut?: ?(event: GestureResponderEvent) => mixed,
868
-
869
- /**
870
- * Callback that is called when the text input selection is changed.
871
- * This will be called with
872
- * `{ nativeEvent: { selection: { start, end } } }`.
873
- */
874
- onSelectionChange?: ?(e: TextInputSelectionChangeEvent) => mixed,
875
-
876
- /**
877
- * Callback that is called when the text input's submit button is pressed.
878
- * Invalid if `multiline={true}` is specified.
879
- */
880
- onSubmitEditing?: ?(e: TextInputEditingEvent) => mixed,
881
-
882
- /**
883
- * Invoked on content scroll with `{ nativeEvent: { contentOffset: { x, y } } }`.
884
- * May also contain other properties from ScrollEvent but on Android contentSize
885
- * is not provided for performance reasons.
886
- */
887
- onScroll?: ?(e: ScrollEvent) => mixed,
888
-
889
- /**
890
- * The string that will be rendered before text input has been entered.
891
- */
892
- placeholder?: ?Stringish,
893
-
894
- /**
895
- * The text color of the placeholder string.
896
- */
897
- placeholderTextColor?: ?ColorValue,
898
-
899
- /** `readOnly` works like the `readonly` attribute in HTML.
900
- * If `true`, text is not editable. The default value is `false`.
901
- * See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly
902
- * for more details.
903
- */
904
- readOnly?: ?boolean,
905
-
906
- /**
907
- * Determines how the return key should look. On Android you can also use
908
- * `returnKeyLabel`.
909
- *
910
- * *Cross platform*
911
- *
912
- * The following values work across platforms:
913
- *
914
- * - `done`
915
- * - `go`
916
- * - `next`
917
- * - `search`
918
- * - `send`
919
- *
920
- * *Android Only*
921
- *
922
- * The following values work on Android only:
923
- *
924
- * - `none`
925
- * - `previous`
926
- *
927
- * *iOS Only*
928
- *
929
- * The following values work on iOS only:
930
- *
931
- * - `default`
932
- * - `emergency-call`
933
- * - `google`
934
- * - `join`
935
- * - `route`
936
- * - `yahoo`
937
- */
938
- returnKeyType?: ?ReturnKeyTypeOptions,
939
-
940
- /**
941
- * If `true`, the text input obscures the text entered so that sensitive text
942
- * like passwords stay secure. The default value is `false`. Does not work with 'multiline={true}'.
943
- */
944
- secureTextEntry?: ?boolean,
945
-
946
- /**
947
- * The start and end of the text input's selection. Set start and end to
948
- * the same value to position the cursor.
949
- */
950
- selection?: ?$ReadOnly<{
951
- start: number,
952
- end?: ?number,
953
- }>,
954
-
955
- /**
956
- * The highlight and cursor color of the text input.
957
- */
958
- selectionColor?: ?ColorValue,
959
-
960
- /**
961
- * The text selection handle color.
962
- * @platform android
963
- */
964
- selectionHandleColor?: ?ColorValue,
965
-
966
- /**
967
- * If `true`, all text will automatically be selected on focus.
968
- */
969
- selectTextOnFocus?: ?boolean,
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]
130
+ };
970
131
 
132
+ type TextInputStateType = $ReadOnly<{
971
133
  /**
972
- * If `true`, the text field will blur when submitted.
973
- * The default value is true for single-line fields and false for
974
- * multiline fields. Note that for multiline fields, setting `blurOnSubmit`
975
- * to `true` means that pressing return will blur the field and trigger the
976
- * `onSubmitEditing` event instead of inserting a newline into the field.
977
- *
978
- * @deprecated
979
- * Note that `submitBehavior` now takes the place of `blurOnSubmit` and will
980
- * override any behavior defined by `blurOnSubmit`.
981
- * @see submitBehavior
134
+ * @deprecated Use currentlyFocusedInput
135
+ * Returns the ID of the currently focused text field, if one exists
136
+ * If no text field is focused it returns null
982
137
  */
983
- blurOnSubmit?: ?boolean,
138
+ currentlyFocusedField: () => ?number,
984
139
 
985
140
  /**
986
- * When the return key is pressed,
987
- *
988
- * For single line inputs:
989
- *
990
- * - `'newline`' defaults to `'blurAndSubmit'`
991
- * - `undefined` defaults to `'blurAndSubmit'`
992
- *
993
- * For multiline inputs:
994
- *
995
- * - `'newline'` adds a newline
996
- * - `undefined` defaults to `'newline'`
997
- *
998
- * For both single line and multiline inputs:
999
- *
1000
- * - `'submit'` will only send a submit event and not blur the input
1001
- * - `'blurAndSubmit`' will both blur the input and send a submit event
141
+ * Returns the ref of the currently focused text field, if one exists
142
+ * If no text field is focused it returns null
1002
143
  */
1003
- submitBehavior?: ?SubmitBehavior,
144
+ currentlyFocusedInput: () => ?HostInstance,
1004
145
 
1005
146
  /**
1006
- * Note that not all Text styles are supported, an incomplete list of what is not supported includes:
1007
- *
1008
- * - `borderLeftWidth`
1009
- * - `borderTopWidth`
1010
- * - `borderRightWidth`
1011
- * - `borderBottomWidth`
1012
- * - `borderTopLeftRadius`
1013
- * - `borderTopRightRadius`
1014
- * - `borderBottomRightRadius`
1015
- * - `borderBottomLeftRadius`
1016
- *
1017
- * see [Issue#7070](https://github.com/facebook/react-native/issues/7070)
1018
- * for more detail.
1019
- *
1020
- * [Styles](docs/style.html)
147
+ * @param textField ref of the text field to focus
148
+ * Focuses the specified text field
149
+ * noop if the text field was already focused
1021
150
  */
1022
- style?: ?TextStyleProp,
151
+ focusTextInput: (textField: ?HostInstance) => void,
1023
152
 
1024
153
  /**
1025
- * The value to show for the text input. `TextInput` is a controlled
1026
- * component, which means the native value will be forced to match this
1027
- * value prop if provided. For most uses, this works great, but in some
1028
- * cases this may cause flickering - one common cause is preventing edits
1029
- * by keeping value the same. In addition to simply setting the same value,
1030
- * either set `editable={false}`, or set/update `maxLength` to prevent
1031
- * unwanted edits without flicker.
154
+ * @param textField ref of the text field to focus
155
+ * Unfocuses the specified text field
156
+ * noop if it wasn't focused
1032
157
  */
1033
- value?: ?Stringish,
158
+ blurTextInput: (textField: ?HostInstance) => void,
1034
159
  }>;
1035
160
 
1036
161
  type ViewCommands = $NonMaybeType<
@@ -1051,7 +176,7 @@ const emptyFunctionThatReturnsTrue = () => true;
1051
176
  * in native and in JavaScript. This is necessary due to the asynchronous nature
1052
177
  * of text input events.
1053
178
  */
1054
- function useTextInputStateSynchronization_STATE({
179
+ function useTextInputStateSynchronization({
1055
180
  props,
1056
181
  mostRecentEventCount,
1057
182
  selection,
@@ -1127,94 +252,6 @@ function useTextInputStateSynchronization_STATE({
1127
252
  return {setLastNativeText, setLastNativeSelection};
1128
253
  }
1129
254
 
1130
- /**
1131
- * This hook handles the synchronization between the state of the text input
1132
- * in native and in JavaScript. This is necessary due to the asynchronous nature
1133
- * of text input events.
1134
- */
1135
- function useTextInputStateSynchronization_REFS({
1136
- props,
1137
- mostRecentEventCount,
1138
- selection,
1139
- inputRef,
1140
- text,
1141
- viewCommands,
1142
- }: {
1143
- props: TextInputProps,
1144
- mostRecentEventCount: number,
1145
- selection: ?Selection,
1146
- inputRef: React.RefObject<null | TextInputInstance>,
1147
- text?: string,
1148
- viewCommands: ViewCommands,
1149
- }): {
1150
- setLastNativeText: string => void,
1151
- setLastNativeSelection: LastNativeSelection => void,
1152
- } {
1153
- const lastNativeTextRef = useRef<?Stringish>(props.value);
1154
- const lastNativeSelectionRef = useRef<LastNativeSelection>({
1155
- selection: {start: -1, end: -1},
1156
- mostRecentEventCount: mostRecentEventCount,
1157
- });
1158
-
1159
- // This is necessary in case native updates the text and JS decides
1160
- // that the update should be ignored and we should stick with the value
1161
- // that we have in JS.
1162
- useLayoutEffect(() => {
1163
- const nativeUpdate: {text?: string, selection?: Selection} = {};
1164
-
1165
- const lastNativeSelection = lastNativeSelectionRef.current.selection;
1166
-
1167
- if (
1168
- lastNativeTextRef.current !== props.value &&
1169
- typeof props.value === 'string'
1170
- ) {
1171
- nativeUpdate.text = props.value;
1172
- lastNativeTextRef.current = props.value;
1173
- }
1174
-
1175
- if (
1176
- selection &&
1177
- lastNativeSelection &&
1178
- (lastNativeSelection.start !== selection.start ||
1179
- lastNativeSelection.end !== selection.end)
1180
- ) {
1181
- nativeUpdate.selection = selection;
1182
- lastNativeSelectionRef.current = {selection, mostRecentEventCount};
1183
- }
1184
-
1185
- if (Object.keys(nativeUpdate).length === 0) {
1186
- return;
1187
- }
1188
-
1189
- if (inputRef.current != null) {
1190
- viewCommands.setTextAndSelection(
1191
- inputRef.current,
1192
- mostRecentEventCount,
1193
- text,
1194
- selection?.start ?? -1,
1195
- selection?.end ?? -1,
1196
- );
1197
- }
1198
- }, [
1199
- mostRecentEventCount,
1200
- inputRef,
1201
- props.value,
1202
- props.defaultValue,
1203
- selection,
1204
- text,
1205
- viewCommands,
1206
- ]);
1207
-
1208
- return {
1209
- setLastNativeText: lastNativeText => {
1210
- lastNativeTextRef.current = lastNativeText;
1211
- },
1212
- setLastNativeSelection: lastNativeSelection => {
1213
- lastNativeSelectionRef.current = lastNativeSelection;
1214
- },
1215
- };
1216
- }
1217
-
1218
255
  /**
1219
256
  * A foundational component for inputting text into the app via a
1220
257
  * keyboard. Props provide configurability for several features, such as
@@ -1370,10 +407,6 @@ function InternalTextInput(props: TextInputProps): React.Node {
1370
407
  : RCTSinglelineTextInputNativeCommands);
1371
408
 
1372
409
  const [mostRecentEventCount, setMostRecentEventCount] = useState<number>(0);
1373
- const useTextInputStateSynchronization =
1374
- ReactNativeFeatureFlags.useRefsForTextInputState()
1375
- ? useTextInputStateSynchronization_REFS
1376
- : useTextInputStateSynchronization_STATE;
1377
410
  const {setLastNativeText, setLastNativeSelection} =
1378
411
  useTextInputStateSynchronization({
1379
412
  props,
@@ -1725,6 +758,7 @@ function InternalTextInput(props: TextInputProps): React.Node {
1725
758
  ref={(ref: $FlowFixMe)}
1726
759
  {...otherProps}
1727
760
  {...eventHandlers}
761
+ acceptDragAndDropTypes={props.experimental_acceptDragAndDropTypes}
1728
762
  accessibilityErrorMessage={accessibilityErrorMessage}
1729
763
  accessibilityState={_accessibilityState}
1730
764
  accessible={accessible}
@@ -1793,6 +827,7 @@ function InternalTextInput(props: TextInputProps): React.Node {
1793
827
  accessibilityState={_accessibilityState}
1794
828
  accessibilityLabelledBy={_accessibilityLabelledBy}
1795
829
  accessible={accessible}
830
+ acceptDragAndDropTypes={props.experimental_acceptDragAndDropTypes}
1796
831
  autoCapitalize={autoCapitalize}
1797
832
  submitBehavior={submitBehavior}
1798
833
  caretHidden={caretHidden}
@@ -1947,7 +982,7 @@ const autoCompleteWebToTextContentTypeMap = {
1947
982
  };
1948
983
 
1949
984
  const ExportedForwardRef: component(
1950
- ref: React.RefSetter<TextInputInstance>,
985
+ ref?: React.RefSetter<TextInputInstance>,
1951
986
  ...props: React.ElementConfig<typeof InternalTextInput>
1952
987
  ) = React.forwardRef(function TextInput(
1953
988
  {
@@ -2018,12 +1053,7 @@ ExportedForwardRef.State = {
2018
1053
  };
2019
1054
 
2020
1055
  export type TextInputComponentStatics = $ReadOnly<{
2021
- State: $ReadOnly<{
2022
- currentlyFocusedInput: typeof TextInputState.currentlyFocusedInput,
2023
- currentlyFocusedField: typeof TextInputState.currentlyFocusedField,
2024
- focusTextInput: typeof TextInputState.focusTextInput,
2025
- blurTextInput: typeof TextInputState.blurTextInput,
2026
- }>,
1056
+ State: TextInputStateType,
2027
1057
  }>;
2028
1058
 
2029
1059
  const styles = StyleSheet.create({