@office-iss/react-native-win32 0.79.1 → 0.80.0

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 +117 -24
  3. package/CHANGELOG.md +49 -14
  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 +1 -1
  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 +25 -25
  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
@@ -13,12 +13,34 @@
13
13
  import typeof ProgressBarAndroidNativeComponentType from './ProgressBarAndroidNativeComponent';
14
14
  import type {ProgressBarAndroidProps} from './ProgressBarAndroidTypes';
15
15
 
16
+ import Platform from '../../Utilities/Platform';
17
+
16
18
  export type {ProgressBarAndroidProps};
17
19
 
18
- export default require('../UnimplementedViews/UnimplementedView')
19
- .default as $FlowFixMe as component(
20
+ // A utility type to preserve the semantics of the union uses in the definition
21
+ // of ProgressBarAndroidProps. TS's Omit does not distribute over unions, so
22
+ // we define our own version which does. This does not affect Flow.
23
+ // $FlowExpectedError[unclear-type]
24
+ type Omit<T, K> = T extends any ? Pick<T, Exclude<$Keys<T>, K>> : T;
25
+
26
+ /**
27
+ * ProgressBarAndroid has been extracted from react-native core and will be removed in a future release.
28
+ * It can now be installed and imported from `@react-native-community/progress-bar-android` instead of 'react-native'.
29
+ * @see https://github.com/react-native-community/progress-bar-android
30
+ * @deprecated
31
+ */
32
+ let ProgressBarAndroid: component(
20
33
  ref?: React.RefSetter<
21
34
  React.ElementRef<ProgressBarAndroidNativeComponentType>,
22
35
  >,
23
- ...props: ProgressBarAndroidProps
36
+ ...props: Omit<ProgressBarAndroidProps, empty>
24
37
  );
38
+
39
+ if (Platform.OS === 'android') {
40
+ ProgressBarAndroid = require('./ProgressBarAndroid').default;
41
+ } else {
42
+ ProgressBarAndroid = require('../UnimplementedViews/UnimplementedView')
43
+ .default as $FlowFixMe;
44
+ }
45
+
46
+ export default ProgressBarAndroid;
@@ -17,28 +17,25 @@ import type {ViewProps} from '../View/ViewPropTypes';
17
17
  * `indeterminate` can only be false if `styleAttr` is Horizontal, and requires a
18
18
  * `progress` value.
19
19
  */
20
- type ProgressBarAndroidStyleAttrProp =
21
- | {
22
- styleAttr: 'Horizontal',
23
- indeterminate: false,
24
- progress: number,
25
- }
26
- | {
27
- styleAttr:
28
- | 'Horizontal'
29
- | 'Normal'
30
- | 'Small'
31
- | 'Large'
32
- | 'Inverse'
33
- | 'SmallInverse'
34
- | 'LargeInverse',
35
- indeterminate: true,
36
- };
20
+ type DeterminateProgressBarAndroidStyleAttrProp = {
21
+ styleAttr: 'Horizontal',
22
+ indeterminate: false,
23
+ progress: number,
24
+ };
37
25
 
38
- export type ProgressBarAndroidProps = $ReadOnly<{
39
- ...ViewProps,
40
- ...ProgressBarAndroidStyleAttrProp,
26
+ type IndeterminateProgressBarAndroidStyleAttrProp = {
27
+ styleAttr:
28
+ | 'Horizontal'
29
+ | 'Normal'
30
+ | 'Small'
31
+ | 'Large'
32
+ | 'Inverse'
33
+ | 'SmallInverse'
34
+ | 'LargeInverse',
35
+ indeterminate: true,
36
+ };
41
37
 
38
+ type ProgressBarAndroidBaseProps = $ReadOnly<{
42
39
  /**
43
40
  * Whether to show the ProgressBar (true, the default) or hide it (false).
44
41
  */
@@ -52,3 +49,15 @@ export type ProgressBarAndroidProps = $ReadOnly<{
52
49
  */
53
50
  testID?: ?string,
54
51
  }>;
52
+
53
+ export type ProgressBarAndroidProps =
54
+ | $ReadOnly<{
55
+ ...ViewProps,
56
+ ...ProgressBarAndroidBaseProps,
57
+ ...DeterminateProgressBarAndroidStyleAttrProp,
58
+ }>
59
+ | $ReadOnly<{
60
+ ...ViewProps,
61
+ ...ProgressBarAndroidBaseProps,
62
+ ...IndeterminateProgressBarAndroidStyleAttrProp,
63
+ }>;
@@ -17,7 +17,7 @@ import AndroidSwipeRefreshLayoutNativeComponent, {
17
17
  import PullToRefreshViewNativeComponent, {
18
18
  Commands as PullToRefreshCommands,
19
19
  } from './PullToRefreshViewNativeComponent';
20
- import React from 'react';
20
+ import * as React from 'react';
21
21
 
22
22
  const Platform = require('../../Utilities/Platform').default;
23
23
 
@@ -365,7 +365,7 @@ export interface ScrollViewPropsIOS {
365
365
 
366
366
  /**
367
367
  * When true the scroll view bounces when it reaches the end of the
368
- * content if the content is larger then the scroll view along the axis of
368
+ * content if the content is larger than the scroll view along the axis of
369
369
  * the scroll direction. When false it disables all bouncing even if
370
370
  * the `alwaysBounce*` props are true. The default value is true.
371
371
  */
@@ -405,7 +405,7 @@ export interface ScrollViewPropsIOS {
405
405
 
406
406
  /**
407
407
  * This property specifies how the safe area insets are used to modify the content area of the scroll view.
408
- * The default value of this property must be 'automatic'. But the default value is 'never' until RN@0.51.
408
+ * The default value of this property is "never".
409
409
  */
410
410
  contentInsetAdjustmentBehavior?:
411
411
  | 'automatic'
@@ -869,7 +869,7 @@ export class ScrollView extends ScrollViewBase {
869
869
  * This function sends props straight to native. They will not participate in
870
870
  * future diff process - this means that if you do not include them in the
871
871
  * next render, they will remain active (see [Direct
872
- * Manipulation](https://reactnative.dev/docs/direct-manipulation)).
872
+ * Manipulation](https://reactnative.dev/docs/the-new-architecture/direct-manipulation-new-architecture)).
873
873
  */
874
874
  setNativeProps(nativeProps: object): void;
875
875
  }
@@ -20,18 +20,17 @@ import type {
20
20
  } from '../../Types/CoreEventTypes';
21
21
  import type {EventSubscription} from '../../vendor/emitter/EventEmitter';
22
22
  import type {KeyboardEvent, KeyboardMetrics} from '../Keyboard/Keyboard';
23
- import typeof View from '../View/View';
24
23
  import type {ViewProps} from '../View/ViewPropTypes';
25
24
  import type {ScrollViewStickyHeaderProps} from './ScrollViewStickyHeader';
26
25
 
27
26
  import {
28
27
  HScrollContentViewNativeComponent,
29
28
  HScrollViewNativeComponent,
30
- } from '../../../src/private/components/HScrollViewNativeComponents';
29
+ } from '../../../src/private/components/scrollview/HScrollViewNativeComponents';
31
30
  import {
32
31
  VScrollContentViewNativeComponent,
33
32
  VScrollViewNativeComponent,
34
- } from '../../../src/private/components/VScrollViewNativeComponents';
33
+ } from '../../../src/private/components/scrollview/VScrollViewNativeComponents';
35
34
  import AnimatedImplementation from '../../Animated/AnimatedImplementation';
36
35
  import FrameRateLogger from '../../Interaction/FrameRateLogger';
37
36
  import {findNodeHandle} from '../../ReactNative/RendererProxy';
@@ -44,6 +43,7 @@ import dismissKeyboard from '../../Utilities/dismissKeyboard';
44
43
  import Platform from '../../Utilities/Platform';
45
44
  import Keyboard from '../Keyboard/Keyboard';
46
45
  import TextInputState from '../TextInput/TextInputState';
46
+ import View from '../View/View';
47
47
  import processDecelerationRate from './processDecelerationRate';
48
48
  import Commands from './ScrollViewCommands';
49
49
  import ScrollViewContext, {HORIZONTAL, VERTICAL} from './ScrollViewContext';
@@ -134,19 +134,33 @@ export interface ScrollViewScrollToOptions {
134
134
 
135
135
  // Public methods for ScrollView
136
136
  export interface ScrollViewImperativeMethods {
137
- +getScrollResponder: $PropertyType<ScrollView, 'getScrollResponder'>;
138
- +getScrollableNode: $PropertyType<ScrollView, 'getScrollableNode'>;
139
- +getInnerViewNode: $PropertyType<ScrollView, 'getInnerViewNode'>;
140
- +getInnerViewRef: $PropertyType<ScrollView, 'getInnerViewRef'>;
141
- +getNativeScrollRef: $PropertyType<ScrollView, 'getNativeScrollRef'>;
142
- +scrollTo: $PropertyType<ScrollView, 'scrollTo'>;
143
- +scrollToEnd: $PropertyType<ScrollView, 'scrollToEnd'>;
144
- +flashScrollIndicators: $PropertyType<ScrollView, 'flashScrollIndicators'>;
145
- +scrollResponderZoomTo: $PropertyType<ScrollView, 'scrollResponderZoomTo'>;
146
- +scrollResponderScrollNativeHandleToKeyboard: $PropertyType<
147
- ScrollView,
148
- 'scrollResponderScrollNativeHandleToKeyboard',
149
- >;
137
+ +getScrollResponder: () => ScrollResponderType;
138
+ +getScrollableNode: () => ?number;
139
+ +getInnerViewNode: () => ?number;
140
+ +getInnerViewRef: () => InnerViewInstance | null;
141
+ +getNativeScrollRef: () => HostInstance | null;
142
+ +scrollTo: (
143
+ options?: ScrollViewScrollToOptions | number,
144
+ deprecatedX?: number,
145
+ deprecatedAnimated?: boolean,
146
+ ) => void;
147
+ +scrollToEnd: (options?: ?ScrollViewScrollToOptions) => void;
148
+ +flashScrollIndicators: () => void;
149
+ +scrollResponderZoomTo: (
150
+ rect: {
151
+ x: number,
152
+ y: number,
153
+ width: number,
154
+ height: number,
155
+ animated?: boolean,
156
+ },
157
+ animated?: boolean, // deprecated, put this inside the rect argument instead
158
+ ) => void;
159
+ +scrollResponderScrollNativeHandleToKeyboard: (
160
+ nodeHandle: number | HostInstance,
161
+ additionalOffset?: number,
162
+ preventNegativeScrollOffset?: boolean,
163
+ ) => void;
150
164
  }
151
165
 
152
166
  export type DecelerationRateType = 'fast' | 'normal' | number;
@@ -156,7 +170,7 @@ export interface PublicScrollViewInstance
156
170
  extends HostInstance,
157
171
  ScrollViewImperativeMethods {}
158
172
 
159
- type InnerViewInstance = React.ElementRef<View>;
173
+ type InnerViewInstance = React.ElementRef<typeof View>;
160
174
 
161
175
  export type ScrollViewPropsIOS = $ReadOnly<{
162
176
  /**
@@ -303,7 +317,7 @@ export type ScrollViewPropsIOS = $ReadOnly<{
303
317
  /**
304
318
  * This property specifies how the safe area insets are used to modify the
305
319
  * content area of the scroll view. The default value of this property is
306
- * "never". Available on iOS 11 and later.
320
+ * "never".
307
321
  * @platform ios
308
322
  */
309
323
  contentInsetAdjustmentBehavior?: ?(
@@ -376,11 +390,7 @@ type StickyHeaderComponentType = component(
376
390
  ...ScrollViewStickyHeaderProps
377
391
  );
378
392
 
379
- export type ScrollViewProps = $ReadOnly<{
380
- ...ViewProps,
381
- ...ScrollViewPropsIOS,
382
- ...ScrollViewPropsAndroid,
383
-
393
+ type ScrollViewBaseProps = $ReadOnly<{
384
394
  /**
385
395
  * These styles will be applied to the scroll view content container which
386
396
  * wraps all of the child views. Example:
@@ -643,7 +653,7 @@ export type ScrollViewProps = $ReadOnly<{
643
653
  */
644
654
  /* $FlowFixMe[unclear-type] - how to handle generic type without existential
645
655
  * operator? */
646
- refreshControl?: ?React.Node,
656
+ refreshControl?: ?React.MixedElement,
647
657
  children?: React.Node,
648
658
  /**
649
659
  * A ref to the inner View element of the ScrollView. This should be used
@@ -658,7 +668,14 @@ export type ScrollViewProps = $ReadOnly<{
658
668
  scrollViewRef?: React.RefSetter<PublicScrollViewInstance>,
659
669
  }>;
660
670
 
661
- type State = {
671
+ export type ScrollViewProps = $ReadOnly<{
672
+ ...ViewProps,
673
+ ...ScrollViewPropsIOS,
674
+ ...ScrollViewPropsAndroid,
675
+ ...ScrollViewBaseProps,
676
+ }>;
677
+
678
+ type ScrollViewState = {
662
679
  layoutHeight: ?number,
663
680
  };
664
681
 
@@ -703,7 +720,7 @@ export type ScrollViewComponentStatics = $ReadOnly<{
703
720
  * multiple columns, infinite scroll loading, or any number of other features it
704
721
  * supports out of the box.
705
722
  */
706
- class ScrollView extends React.Component<ScrollViewProps, State> {
723
+ class ScrollView extends React.Component<ScrollViewProps, ScrollViewState> {
707
724
  static Context: typeof ScrollViewContext = ScrollViewContext;
708
725
 
709
726
  constructor(props: ScrollViewProps) {
@@ -745,7 +762,7 @@ class ScrollView extends React.Component<ScrollViewProps, State> {
745
762
  _subscriptionKeyboardDidShow: ?EventSubscription = null;
746
763
  _subscriptionKeyboardDidHide: ?EventSubscription = null;
747
764
 
748
- state: State = {
765
+ state: ScrollViewState = {
749
766
  layoutHeight: null,
750
767
  };
751
768
 
@@ -823,26 +840,28 @@ class ScrollView extends React.Component<ScrollViewProps, State> {
823
840
  * implement this method so that they can be composed while providing access
824
841
  * to the underlying scroll responder's methods.
825
842
  */
826
- getScrollResponder: () => ScrollResponderType = () => {
827
- // $FlowFixMe[unclear-type]
828
- return ((this: any): ScrollResponderType);
829
- };
843
+ getScrollResponder: ScrollViewImperativeMethods['getScrollResponder'] =
844
+ () => {
845
+ // $FlowFixMe[unclear-type]
846
+ return ((this: any): ScrollResponderType);
847
+ };
830
848
 
831
- getScrollableNode: () => ?number = () => {
832
- return findNodeHandle(this.getNativeScrollRef());
849
+ getScrollableNode: ScrollViewImperativeMethods['getScrollableNode'] = () => {
850
+ return findNodeHandle<$FlowFixMe>(this.getNativeScrollRef());
833
851
  };
834
852
 
835
- getInnerViewNode: () => ?number = () => {
836
- return findNodeHandle(this._innerView.nativeInstance);
853
+ getInnerViewNode: ScrollViewImperativeMethods['getInnerViewNode'] = () => {
854
+ return findNodeHandle<$FlowFixMe>(this._innerView.nativeInstance);
837
855
  };
838
856
 
839
- getInnerViewRef: () => InnerViewInstance | null = () => {
857
+ getInnerViewRef: ScrollViewImperativeMethods['getInnerViewRef'] = () => {
840
858
  return this._innerView.nativeInstance;
841
859
  };
842
860
 
843
- getNativeScrollRef: () => HostInstance | null = () => {
844
- return this._scrollView.nativeInstance;
845
- };
861
+ getNativeScrollRef: ScrollViewImperativeMethods['getNativeScrollRef'] =
862
+ () => {
863
+ return this._scrollView.nativeInstance;
864
+ };
846
865
 
847
866
  /**
848
867
  * Scrolls to a given x, y offset, either immediately or with a smooth animation.
@@ -855,11 +874,11 @@ class ScrollView extends React.Component<ScrollViewProps, State> {
855
874
  * the function also accepts separate arguments as an alternative to the options object.
856
875
  * This is deprecated due to ambiguity (y before x), and SHOULD NOT BE USED.
857
876
  */
858
- scrollTo: (
859
- options?: ScrollViewScrollToOptions | number,
860
- deprecatedX?: number,
861
- deprecatedAnimated?: boolean,
862
- ) => void = (options, deprecatedX, deprecatedAnimated) => {
877
+ scrollTo: ScrollViewImperativeMethods['scrollTo'] = (
878
+ options,
879
+ deprecatedX,
880
+ deprecatedAnimated,
881
+ ) => {
863
882
  let x, y, animated;
864
883
  if (typeof options === 'number') {
865
884
  console.warn(
@@ -889,7 +908,7 @@ class ScrollView extends React.Component<ScrollViewProps, State> {
889
908
  * `scrollToEnd({animated: false})` for immediate scrolling.
890
909
  * If no options are passed, `animated` defaults to true.
891
910
  */
892
- scrollToEnd: (options?: ?ScrollViewScrollToOptions) => void = options => {
911
+ scrollToEnd: ScrollViewImperativeMethods['scrollToEnd'] = options => {
893
912
  // Default to true
894
913
  const animated = (options && options.animated) !== false;
895
914
  const component = this.getNativeScrollRef();
@@ -904,13 +923,14 @@ class ScrollView extends React.Component<ScrollViewProps, State> {
904
923
  *
905
924
  * @platform ios
906
925
  */
907
- flashScrollIndicators: () => void = () => {
908
- const component = this.getNativeScrollRef();
909
- if (component == null) {
910
- return;
911
- }
912
- Commands.flashScrollIndicators(component);
913
- };
926
+ flashScrollIndicators: ScrollViewImperativeMethods['flashScrollIndicators'] =
927
+ () => {
928
+ const component = this.getNativeScrollRef();
929
+ if (component == null) {
930
+ return;
931
+ }
932
+ Commands.flashScrollIndicators(component);
933
+ };
914
934
 
915
935
  /**
916
936
  * This method should be used as the callback to onFocus in a TextInputs'
@@ -922,39 +942,36 @@ class ScrollView extends React.Component<ScrollViewProps, State> {
922
942
  * @param {bool} preventNegativeScrolling Whether to allow pulling the content
923
943
  * down to make it meet the keyboard's top. Default is false.
924
944
  */
925
- scrollResponderScrollNativeHandleToKeyboard: (
926
- nodeHandle: number | HostInstance,
927
- additionalOffset?: number,
928
- preventNegativeScrollOffset?: boolean,
929
- ) => void = (
930
- nodeHandle: number | HostInstance,
931
- additionalOffset?: number,
932
- preventNegativeScrollOffset?: boolean,
933
- ) => {
934
- this._additionalScrollOffset = additionalOffset || 0;
935
- this._preventNegativeScrollOffset = !!preventNegativeScrollOffset;
936
-
937
- if (this._innerView.nativeInstance == null) {
938
- return;
939
- }
945
+ scrollResponderScrollNativeHandleToKeyboard: ScrollViewImperativeMethods['scrollResponderScrollNativeHandleToKeyboard'] =
946
+ (
947
+ nodeHandle: number | HostInstance,
948
+ additionalOffset?: number,
949
+ preventNegativeScrollOffset?: boolean,
950
+ ) => {
951
+ this._additionalScrollOffset = additionalOffset || 0;
952
+ this._preventNegativeScrollOffset = !!preventNegativeScrollOffset;
953
+
954
+ if (this._innerView.nativeInstance == null) {
955
+ return;
956
+ }
940
957
 
941
- if (typeof nodeHandle === 'number') {
942
- UIManager.measureLayout(
943
- nodeHandle,
944
- nullthrows(findNodeHandle(this)),
945
- // $FlowFixMe[method-unbinding] added when improving typing for this parameters
946
- this._textInputFocusError,
947
- this._inputMeasureAndScrollToKeyboard,
948
- );
949
- } else {
950
- nodeHandle.measureLayout(
951
- this._innerView.nativeInstance,
952
- this._inputMeasureAndScrollToKeyboard,
953
- // $FlowFixMe[method-unbinding] added when improving typing for this parameters
954
- this._textInputFocusError,
955
- );
956
- }
957
- };
958
+ if (typeof nodeHandle === 'number') {
959
+ UIManager.measureLayout(
960
+ nodeHandle,
961
+ nullthrows(findNodeHandle<$FlowFixMe>(this)),
962
+ // $FlowFixMe[method-unbinding] added when improving typing for this parameters
963
+ this._textInputFocusError,
964
+ this._inputMeasureAndScrollToKeyboard,
965
+ );
966
+ } else {
967
+ nodeHandle.measureLayout(
968
+ this._innerView.nativeInstance,
969
+ this._inputMeasureAndScrollToKeyboard,
970
+ // $FlowFixMe[method-unbinding] added when improving typing for this parameters
971
+ this._textInputFocusError,
972
+ );
973
+ }
974
+ };
958
975
 
959
976
  /**
960
977
  * A helper function to zoom to a specific rect in the scrollview. The argument has the shape
@@ -962,41 +979,33 @@ class ScrollView extends React.Component<ScrollViewProps, State> {
962
979
  *
963
980
  * @platform ios
964
981
  */
965
- scrollResponderZoomTo: (
966
- rect: {
967
- x: number,
968
- y: number,
969
- width: number,
970
- height: number,
971
- animated?: boolean,
972
- },
973
- animated?: boolean, // deprecated, put this inside the rect argument instead
974
- ) => void = (
975
- rect: {
976
- x: number,
977
- y: number,
978
- width: number,
979
- height: number,
980
- animated?: boolean,
981
- },
982
- animated?: boolean, // deprecated, put this inside the rect argument instead
983
- ) => {
984
- invariant(Platform.OS === 'ios', 'zoomToRect is not implemented');
985
- if ('animated' in rect) {
986
- this._animated = rect.animated;
987
- delete rect.animated;
988
- } else if (typeof animated !== 'undefined') {
989
- console.warn(
990
- '`scrollResponderZoomTo` `animated` argument is deprecated. Use `options.animated` instead',
991
- );
992
- }
982
+ scrollResponderZoomTo: ScrollViewImperativeMethods['scrollResponderZoomTo'] =
983
+ (
984
+ rect: {
985
+ x: number,
986
+ y: number,
987
+ width: number,
988
+ height: number,
989
+ animated?: boolean,
990
+ },
991
+ animated?: boolean, // deprecated, put this inside the rect argument instead
992
+ ) => {
993
+ invariant(Platform.OS === 'ios', 'zoomToRect is not implemented');
994
+ if ('animated' in rect) {
995
+ this._animated = rect.animated;
996
+ delete rect.animated;
997
+ } else if (typeof animated !== 'undefined') {
998
+ console.warn(
999
+ '`scrollResponderZoomTo` `animated` argument is deprecated. Use `options.animated` instead',
1000
+ );
1001
+ }
993
1002
 
994
- const component = this.getNativeScrollRef();
995
- if (component == null) {
996
- return;
997
- }
998
- Commands.zoomToRect(component, rect, animated !== false);
999
- };
1003
+ const component = this.getNativeScrollRef();
1004
+ if (component == null) {
1005
+ return;
1006
+ }
1007
+ Commands.zoomToRect(component, rect, animated !== false);
1008
+ };
1000
1009
 
1001
1010
  _textInputFocusError() {
1002
1011
  console.warn('Error measuring text field.');
@@ -1156,6 +1165,7 @@ class ScrollView extends React.Component<ScrollViewProps, State> {
1156
1165
  // they are callable from the ref.
1157
1166
 
1158
1167
  // $FlowFixMe[prop-missing] - Known issue with appending custom methods.
1168
+ // $FlowFixMe[unsafe-object-assign]
1159
1169
  const publicInstance: PublicScrollViewInstance = Object.assign(
1160
1170
  nativeInstance,
1161
1171
  {
@@ -1901,7 +1911,7 @@ function createRefForwarder<TNativeInstance, TPublicInstance>(
1901
1911
  // NOTE: This wrapper component is necessary because `ScrollView` is a class
1902
1912
  // component and we need to map `ref` to a differently named prop. This can be
1903
1913
  // removed when `ScrollView` is a functional component.
1904
- const Wrapper: component(
1914
+ const ScrollViewWrapper: component(
1905
1915
  ref?: React.RefSetter<PublicScrollViewInstance>,
1906
1916
  ...props: ScrollViewProps
1907
1917
  ) = React.forwardRef(function Wrapper(
@@ -1914,9 +1924,9 @@ const Wrapper: component(
1914
1924
  <ScrollView {...props} scrollViewRef={ref} />
1915
1925
  );
1916
1926
  });
1917
- Wrapper.displayName = 'ScrollView';
1927
+ ScrollViewWrapper.displayName = 'ScrollView';
1918
1928
  // $FlowExpectedError[prop-missing]
1919
- Wrapper.Context = ScrollViewContext;
1929
+ ScrollViewWrapper.Context = ScrollViewContext;
1920
1930
 
1921
- export default ((Wrapper: $FlowFixMe): typeof Wrapper &
1931
+ export default ((ScrollViewWrapper: $FlowFixMe): typeof ScrollViewWrapper &
1922
1932
  ScrollViewComponentStatics);
@@ -10,7 +10,7 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- import React from 'react';
13
+ import * as React from 'react';
14
14
 
15
15
  type Props = $ReadOnly<{
16
16
  /**
@@ -38,6 +38,9 @@ export interface SwitchPropsIOS extends ViewProps {
38
38
  tintColor?: ColorValue | undefined;
39
39
  }
40
40
 
41
+ /**
42
+ * @deprecated Use `SwitchChangeEvent` instead.
43
+ */
41
44
  export interface SwitchChangeEventData extends TargetedEvent {
42
45
  value: boolean;
43
46
  }
@@ -22,6 +22,7 @@ import SwitchNativeComponent, {
22
22
  Commands as SwitchCommands,
23
23
  } from './SwitchNativeComponent';
24
24
  import * as React from 'react';
25
+ import {useLayoutEffect, useRef, useState} from 'react';
25
26
 
26
27
  export type SwitchPropsIOS = {
27
28
  /**
@@ -46,7 +47,7 @@ export type SwitchPropsIOS = {
46
47
  tintColor?: ?ColorValue,
47
48
  };
48
49
 
49
- export type SwitchChangeEventData = $ReadOnly<{
50
+ type SwitchChangeEventData = $ReadOnly<{
50
51
  target: number,
51
52
  value: boolean,
52
53
  }>;
@@ -179,13 +180,16 @@ const Switch: component(
179
180
  const trackColorForFalse = trackColor?.false;
180
181
  const trackColorForTrue = trackColor?.true;
181
182
 
182
- const nativeSwitchRef = React.useRef<React.ElementRef<
183
+ const nativeSwitchRef = useRef<React.ElementRef<
183
184
  typeof SwitchNativeComponent | typeof AndroidSwitchNativeComponent,
184
185
  > | null>(null);
185
186
 
186
187
  const ref = useMergeRefs(nativeSwitchRef, forwardedRef);
187
188
 
188
- const [native, setNative] = React.useState({value: (null: ?boolean)});
189
+ // We wrap the native state in an object to force the layout-effect
190
+ // below to re-run whenever we get an update from native, even if it's
191
+ // not different from the previous native state.
192
+ const [native, setNative] = useState({value: (null: ?boolean)});
189
193
 
190
194
  const handleChange = (event: SwitchChangeEvent) => {
191
195
  // $FlowFixMe[unused-promise]
@@ -195,7 +199,7 @@ const Switch: component(
195
199
  setNative({value: event.nativeEvent.value});
196
200
  };
197
201
 
198
- React.useLayoutEffect(() => {
202
+ useLayoutEffect(() => {
199
203
  // This is necessary in case native updates the switch and JS decides
200
204
  // that the update should be ignored and we should stick with the value
201
205
  // that we have in JS.
@@ -70,7 +70,7 @@ export type SubmitBehavior = 'submit' | 'blurAndSubmit' | 'newline';
70
70
  export type NativeProps = $ReadOnly<{
71
71
  // This allows us to inherit everything from ViewProps except for style (see below)
72
72
  // This must be commented for Fabric codegen to work.
73
- ...$Diff<ViewProps, $ReadOnly<{style: ?ViewStyleProp}>>,
73
+ ...Omit<ViewProps, 'style'>,
74
74
 
75
75
  /**
76
76
  * Android props after this
@@ -658,6 +658,7 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = {
658
658
  },
659
659
  },
660
660
  validAttributes: {
661
+ acceptDragAndDropTypes: true,
661
662
  maxFontSizeMultiplier: true,
662
663
  adjustsFontSizeToFit: true,
663
664
  minimumFontScale: true,
@@ -12,10 +12,7 @@ import type {PartialViewConfig} from '../../Renderer/shims/ReactNativeTypes';
12
12
 
13
13
  import {ConditionallyIgnoredEventHandlers} from '../../NativeComponent/ViewConfigIgnore';
14
14
 
15
- type PartialViewConfigWithoutName = $Rest<
16
- PartialViewConfig,
17
- {uiViewClassName: string},
18
- >;
15
+ type PartialViewConfigWithoutName = Omit<PartialViewConfig, 'uiViewClassName'>;
19
16
 
20
17
  const RCTTextInputViewConfig = {
21
18
  bubblingEventTypes: {
@@ -93,6 +90,7 @@ const RCTTextInputViewConfig = {
93
90
  },
94
91
  },
95
92
  validAttributes: {
93
+ acceptDragAndDropTypes: true,
96
94
  dynamicTypeRamp: true,
97
95
  fontSize: true,
98
96
  fontWeight: true,
@@ -1,8 +1,9 @@
1
+ import React from 'react';
1
2
  export declare const title = "TextInput";
2
3
  export declare const displayName = "TextInput";
3
4
  export declare const description = "TextInput Examples and Tests";
4
5
  export declare const examples: {
5
6
  title: string;
6
7
  description: string;
7
- render(): JSX.Element;
8
+ render(): React.JSX.Element;
8
9
  }[];