@office-iss/react-native-win32 0.71.5 → 0.72.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 (324) hide show
  1. package/.flowconfig +15 -3
  2. package/CHANGELOG.json +302 -47
  3. package/CHANGELOG.md +141 -27
  4. package/IntegrationTests/IntegrationTestHarnessTest.js +1 -0
  5. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +1 -1
  6. package/Libraries/Alert/Alert.d.ts +4 -4
  7. package/Libraries/Alert/Alert.win32.js +1 -0
  8. package/Libraries/Animated/Animated.d.ts +17 -6
  9. package/Libraries/Animated/NativeAnimatedHelper.js +18 -6
  10. package/Libraries/Animated/NativeAnimatedHelper.win32.js +606 -0
  11. package/Libraries/Animated/bezier.js +1 -1
  12. package/Libraries/Animated/components/AnimatedFlatList.js +8 -3
  13. package/Libraries/Animated/components/AnimatedScrollView.js +4 -1
  14. package/Libraries/Animated/components/AnimatedSectionList.js +12 -3
  15. package/Libraries/Animated/createAnimatedComponent.js +26 -239
  16. package/Libraries/Animated/nodes/AnimatedColor.js +47 -80
  17. package/Libraries/Animated/nodes/AnimatedInterpolation.js +167 -121
  18. package/Libraries/Animated/nodes/AnimatedNode.js +3 -5
  19. package/Libraries/Animated/nodes/AnimatedProps.js +7 -6
  20. package/Libraries/Animated/nodes/AnimatedStyle.js +42 -8
  21. package/Libraries/Animated/nodes/AnimatedTransform.js +1 -1
  22. package/Libraries/Animated/nodes/AnimatedValue.js +8 -12
  23. package/Libraries/Animated/nodes/AnimatedWithChildren.js +1 -1
  24. package/Libraries/Animated/useAnimatedProps.js +7 -10
  25. package/Libraries/BatchedBridge/MessageQueue.js +2 -1
  26. package/Libraries/BatchedBridge/NativeModules.d.ts +1 -1
  27. package/Libraries/BatchedBridge/NativeModules.js +1 -0
  28. package/Libraries/Blob/Blob.js +4 -0
  29. package/Libraries/Blob/FileReader.js +30 -2
  30. package/Libraries/Blob/URL.js +3 -1
  31. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +2 -2
  32. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +2 -3
  33. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +2 -3
  34. package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +6 -4
  35. package/Libraries/Components/Button.js +3 -2
  36. package/Libraries/Components/Button.win32.js +451 -0
  37. package/Libraries/Components/Clipboard/Clipboard.js +1 -1
  38. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +4 -0
  39. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +1 -0
  40. package/Libraries/Components/Pressable/Pressable.d.ts +1 -1
  41. package/Libraries/Components/Pressable/Pressable.js +1 -1
  42. package/Libraries/Components/RefreshControl/RefreshControl.js +1 -0
  43. package/Libraries/Components/SafeAreaView/SafeAreaView.js +1 -2
  44. package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +1 -2
  45. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +12 -6
  46. package/Libraries/Components/ScrollView/ScrollView.d.ts +2 -2
  47. package/Libraries/Components/ScrollView/ScrollView.js +149 -91
  48. package/Libraries/Components/ScrollView/ScrollView.win32.js +1939 -0
  49. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +16 -6
  50. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +5 -7
  51. package/Libraries/Components/ScrollView/ScrollViewViewConfig.js +1 -1
  52. package/Libraries/Components/StatusBar/StatusBar.js +3 -0
  53. package/Libraries/Components/Switch/Switch.js +3 -1
  54. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +21 -11
  55. package/Libraries/Components/TextInput/InputAccessoryView.d.ts +1 -1
  56. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +11 -5
  57. package/Libraries/Components/TextInput/TextInput.Types.win32.d.ts +51 -0
  58. package/Libraries/Components/TextInput/TextInput.Types.win32.js +3 -0
  59. package/Libraries/Components/TextInput/TextInput.Types.win32.js.map +1 -0
  60. package/Libraries/Components/TextInput/TextInput.d.ts +15 -5
  61. package/Libraries/Components/TextInput/TextInput.flow.js +1 -1
  62. package/Libraries/Components/TextInput/TextInput.js +130 -103
  63. package/Libraries/Components/TextInput/TextInput.win32.js +202 -890
  64. package/Libraries/Components/Touchable/Touchable.d.ts +1 -1
  65. package/Libraries/Components/Touchable/Touchable.flow.js +30 -4
  66. package/Libraries/Components/Touchable/Touchable.js +6 -3
  67. package/Libraries/Components/Touchable/Touchable.win32.js +6 -3
  68. package/Libraries/Components/Touchable/TouchableHighlight.js +1 -1
  69. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +2 -2
  70. package/Libraries/Components/Touchable/TouchableOpacity.js +3 -0
  71. package/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts +1 -1
  72. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +2 -2
  73. package/Libraries/Components/TraceUpdateOverlay/TraceUpdateOverlay.js +189 -0
  74. package/Libraries/Components/TraceUpdateOverlay/TraceUpdateOverlayNativeComponent.js +43 -0
  75. package/Libraries/Components/View/ReactNativeStyleAttributes.js +26 -0
  76. package/Libraries/Components/View/View.js +71 -45
  77. package/Libraries/Components/View/View.win32.js +38 -16
  78. package/Libraries/Components/View/ViewAccessibility.d.ts +6 -6
  79. package/Libraries/Components/View/ViewAccessibility.js +10 -1
  80. package/Libraries/Components/View/ViewAccessibility.win32.d.ts +5 -5
  81. package/Libraries/Components/View/ViewNativeComponent.js +32 -8
  82. package/Libraries/Components/View/ViewPropTypes.d.ts +1 -1
  83. package/Libraries/Components/View/ViewPropTypes.js +1 -1
  84. package/Libraries/Components/View/ViewPropTypes.win32.d.ts +1 -1
  85. package/Libraries/Components/View/ViewPropTypes.win32.js +1 -1
  86. package/Libraries/Components/View/ViewWin32.js +3 -3
  87. package/Libraries/Core/Devtools/openFileInEditor.js +1 -0
  88. package/Libraries/Core/Devtools/openURLInBrowser.js +1 -0
  89. package/Libraries/Core/Devtools/parseErrorStack.js +2 -2
  90. package/Libraries/Core/Devtools/parseHermesStack.js +54 -34
  91. package/Libraries/Core/ExceptionsManager.js +2 -2
  92. package/Libraries/Core/InitializeCore.js +2 -1
  93. package/Libraries/Core/ReactNativeVersion.js +3 -3
  94. package/Libraries/Core/ReactNativeVersionCheck.js +1 -9
  95. package/Libraries/Core/ReactNativeVersionCheck.win32.js +1 -9
  96. package/Libraries/Core/Timers/JSTimers.js +1 -1
  97. package/Libraries/Core/Timers/immediateShim.js +1 -0
  98. package/Libraries/Core/Timers/queueMicrotask.js +1 -1
  99. package/Libraries/Core/setUpAlert.js +1 -1
  100. package/Libraries/Core/setUpDOM.js +18 -0
  101. package/Libraries/Core/setUpDeveloperTools.js +1 -1
  102. package/Libraries/Core/setUpGlobals.js +5 -2
  103. package/Libraries/Core/setUpNavigator.js +6 -5
  104. package/Libraries/Core/setUpPerformance.js +23 -13
  105. package/Libraries/Core/setUpReactDevTools.js +2 -0
  106. package/Libraries/Core/setUpSegmentFetcher.js +0 -41
  107. package/Libraries/Core/setUpTimers.js +2 -2
  108. package/Libraries/DOM/Geometry/DOMRect.js +82 -0
  109. package/Libraries/DOM/Geometry/DOMRectReadOnly.js +188 -0
  110. package/Libraries/DOM/Nodes/ReactNativeElement.js +75 -0
  111. package/Libraries/DOM/Nodes/ReadOnlyElement.js +89 -0
  112. package/Libraries/DOM/Nodes/ReadOnlyNode.js +167 -0
  113. package/Libraries/DOM/OldStyleCollections/ArrayLikeUtils.js +46 -0
  114. package/Libraries/DOM/OldStyleCollections/DOMRectList.js +76 -0
  115. package/Libraries/DOM/OldStyleCollections/HTMLCollection.js +82 -0
  116. package/Libraries/DOM/OldStyleCollections/NodeList.js +104 -0
  117. package/Libraries/DevToolsSettings/DevToolsSettingsManager.android.js +35 -0
  118. package/Libraries/DevToolsSettings/DevToolsSettingsManager.d.ts +20 -0
  119. package/Libraries/DevToolsSettings/DevToolsSettingsManager.ios.js +49 -0
  120. package/Libraries/DevToolsSettings/DevToolsSettingsManager.win32.js +35 -0
  121. package/Libraries/{Utilities/NativeDevSplitBundleLoader.js → DevToolsSettings/NativeDevToolsSettingsManager.js} +7 -2
  122. package/Libraries/EventEmitter/NativeEventEmitter.d.ts +1 -2
  123. package/Libraries/EventEmitter/RCTDeviceEventEmitter.d.ts +1 -2
  124. package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +9 -1
  125. package/Libraries/Events/EventPolyfill.js +1 -1
  126. package/Libraries/Image/AssetRegistry.js +1 -1
  127. package/Libraries/Image/AssetSourceResolver.js +3 -3
  128. package/Libraries/Image/Image.android.js +4 -1
  129. package/Libraries/Image/Image.d.ts +63 -2
  130. package/Libraries/Image/Image.ios.js +3 -0
  131. package/Libraries/Image/Image.win32.js +3 -0
  132. package/Libraries/Image/ImageBackground.js +1 -0
  133. package/Libraries/Image/ImageProps.js +1 -1
  134. package/Libraries/Image/ImageViewNativeComponent.js +4 -4
  135. package/Libraries/Image/RelativeImageStub.js +1 -1
  136. package/Libraries/Image/TextInlineImageNativeComponent.js +1 -1
  137. package/Libraries/Image/resolveAssetSource.js +1 -1
  138. package/Libraries/Inspector/DevtoolsOverlay.js +29 -19
  139. package/Libraries/Inspector/ElementBox.js +4 -1
  140. package/Libraries/Inspector/Inspector.js +5 -6
  141. package/Libraries/Inspector/Inspector.win32.js +7 -6
  142. package/Libraries/Inspector/InspectorOverlay.js +3 -3
  143. package/Libraries/Inspector/InspectorOverlay.win32.js +2 -1
  144. package/Libraries/Inspector/NetworkOverlay.js +1 -1
  145. package/Libraries/Interaction/JSEventLoopWatchdog.js +1 -1
  146. package/Libraries/Interaction/PanResponder.js +5 -6
  147. package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -1
  148. package/Libraries/Linking/Linking.js +1 -4
  149. package/Libraries/Lists/FillRateHelper.js +4 -238
  150. package/Libraries/Lists/FlatList.d.ts +15 -22
  151. package/Libraries/Lists/FlatList.js +9 -6
  152. package/Libraries/Lists/SectionList.d.ts +10 -6
  153. package/Libraries/Lists/SectionList.js +5 -3
  154. package/Libraries/Lists/SectionListModern.js +3 -3
  155. package/Libraries/Lists/ViewabilityHelper.js +8 -344
  156. package/Libraries/Lists/VirtualizeUtils.js +4 -244
  157. package/Libraries/Lists/VirtualizedList.js +10 -1867
  158. package/Libraries/Lists/VirtualizedListContext.js +6 -104
  159. package/Libraries/Lists/VirtualizedSectionList.js +9 -602
  160. package/Libraries/Lists/__flowtests__/FlatList-flowtest.js +1 -0
  161. package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +1 -1
  162. package/Libraries/LogBox/Data/LogBoxData.js +1 -1
  163. package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
  164. package/Libraries/LogBox/LogBox.js +1 -1
  165. package/Libraries/LogBox/UI/LogBoxInspector.js +1 -3
  166. package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.win32.js +168 -0
  167. package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +3 -0
  168. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.win32.js +193 -0
  169. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +1 -0
  170. package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +2 -2
  171. package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.win32.js +7 -3
  172. package/Libraries/LogBox/UI/LogBoxMessage.js +87 -5
  173. package/Libraries/LogBox/UI/LogBoxNotification.js +5 -7
  174. package/Libraries/Modal/Modal.js +2 -2
  175. package/Libraries/NativeComponent/BaseViewConfig.android.js +32 -12
  176. package/Libraries/NativeComponent/BaseViewConfig.ios.js +43 -19
  177. package/Libraries/NativeComponent/BaseViewConfig.win32.js +43 -19
  178. package/Libraries/NativeComponent/NativeComponentRegistryUnstable.js +4 -1
  179. package/Libraries/NativeComponent/ViewConfig.js +1 -0
  180. package/Libraries/NativeComponent/ViewConfigIgnore.js +1 -4
  181. package/Libraries/Network/RCTNetworking.android.js +2 -2
  182. package/Libraries/Network/RCTNetworking.ios.js +1 -1
  183. package/Libraries/Network/RCTNetworking.win32.js +1 -1
  184. package/Libraries/Network/XMLHttpRequest.js +1 -1
  185. package/Libraries/Pressability/Pressability.js +11 -5
  186. package/Libraries/Pressability/Pressability.win32.js +9 -3
  187. package/Libraries/ReactNative/AppContainer.js +7 -1
  188. package/Libraries/ReactNative/AppRegistry.d.ts +1 -1
  189. package/Libraries/ReactNative/AppRegistry.js +10 -13
  190. package/Libraries/ReactNative/FabricUIManager.js +24 -8
  191. package/Libraries/ReactNative/NativeUIManager.js +5 -5
  192. package/Libraries/ReactNative/ReactNativeFeatureFlags.js +10 -10
  193. package/Libraries/ReactNative/UIManager.js +142 -1
  194. package/Libraries/ReactNative/getCachedComponentWithDebugName.js +5 -5
  195. package/Libraries/ReactNative/getNativeComponentAttributes.js +1 -1
  196. package/Libraries/ReactNative/requireNativeComponent.d.ts +1 -1
  197. package/Libraries/ReactNative/requireNativeComponent.js +1 -1
  198. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -0
  199. package/Libraries/Renderer/implementations/ReactFabric-dev.js +26 -3
  200. package/Libraries/Renderer/implementations/ReactFabric-prod.js +13 -1
  201. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +13 -1
  202. package/Libraries/Renderer/public/ReactFabricPublicInstanceUtils.js +38 -0
  203. package/Libraries/Renderer/shims/ReactNativeTypes.js +38 -20
  204. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +7 -7
  205. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
  206. package/Libraries/Share/Share.js +1 -1
  207. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +1 -1
  208. package/Libraries/StyleSheet/StyleSheet.js +1 -1
  209. package/Libraries/StyleSheet/StyleSheet.win32.js +1 -1
  210. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +115 -76
  211. package/Libraries/StyleSheet/StyleSheetTypes.js +188 -33
  212. package/Libraries/StyleSheet/flattenStyle.js +2 -0
  213. package/Libraries/StyleSheet/normalizeColor.js +1 -1
  214. package/Libraries/StyleSheet/processColor.js +1 -1
  215. package/Libraries/Text/Text.d.ts +12 -2
  216. package/Libraries/Text/Text.js +50 -41
  217. package/Libraries/Text/TextProps.js +3 -4
  218. package/Libraries/TurboModule/samples/NativeSampleTurboModule.js +6 -0
  219. package/Libraries/Types/CodegenTypes.js +1 -0
  220. package/Libraries/UTFSequence.js +3 -1
  221. package/Libraries/Utilities/Appearance.d.ts +10 -0
  222. package/Libraries/Utilities/Appearance.js +13 -0
  223. package/Libraries/Utilities/Dimensions.js +1 -1
  224. package/Libraries/Utilities/Dimensions.win32.js +1 -1
  225. package/Libraries/Utilities/GlobalPerformanceLogger.js +12 -1
  226. package/Libraries/Utilities/HMRClient.js +16 -10
  227. package/Libraries/Utilities/{createPerformanceLogger.d.ts → IPerformanceLogger.d.ts} +4 -4
  228. package/Libraries/Utilities/IPerformanceLogger.js +49 -0
  229. package/Libraries/Utilities/LoadingView.android.js +28 -11
  230. package/Libraries/Utilities/NativeAppearance.js +1 -0
  231. package/Libraries/Utilities/NativePlatformConstantsWin.js +1 -1
  232. package/Libraries/Utilities/PixelRatio.js +2 -2
  233. package/Libraries/Utilities/Platform.win32.js +1 -1
  234. package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
  235. package/Libraries/Utilities/__mocks__/PixelRatio.js +1 -1
  236. package/Libraries/Utilities/codegenNativeCommands.js +2 -0
  237. package/Libraries/Utilities/createPerformanceLogger.js +55 -43
  238. package/Libraries/Utilities/stringifySafe.js +2 -7
  239. package/Libraries/Utilities/useColorScheme.js +1 -1
  240. package/Libraries/Utilities/useWindowDimensions.js +3 -3
  241. package/Libraries/WebPerformance/EventCounts.js +78 -0
  242. package/Libraries/WebPerformance/MemoryInfo.js +54 -0
  243. package/Libraries/WebPerformance/NativePerformance.js +38 -0
  244. package/Libraries/WebPerformance/NativePerformanceObserver.js +22 -7
  245. package/Libraries/WebPerformance/Performance.js +312 -0
  246. package/Libraries/WebPerformance/PerformanceEntry.js +45 -0
  247. package/Libraries/WebPerformance/PerformanceEventTiming.js +38 -0
  248. package/Libraries/WebPerformance/PerformanceObserver.js +196 -101
  249. package/Libraries/WebPerformance/RawPerformanceEntry.js +87 -0
  250. package/Libraries/WebPerformance/ReactNativeStartupTiming.js +65 -0
  251. package/Libraries/WebPerformance/__mocks__/NativePerformance.js +65 -0
  252. package/Libraries/WebPerformance/__mocks__/NativePerformanceObserver.js +101 -0
  253. package/Libraries/YellowBox/YellowBoxDeprecated.js +1 -1
  254. package/Libraries/vendor/core/ErrorUtils.js +1 -1
  255. package/Libraries/vendor/emitter/EventEmitter.d.ts +2 -2
  256. package/Libraries/vendor/emitter/EventEmitter.js +9 -1
  257. package/flow/global.js +29 -4
  258. package/flow/jest.js +258 -164
  259. package/index.js +56 -42
  260. package/index.win32.js +56 -42
  261. package/interface.js +1 -1
  262. package/jest/local-setup.js +33 -0
  263. package/jest/mockComponent.js +4 -2
  264. package/jest/mockNativeComponent.js +1 -1
  265. package/jest/mockScrollView.js +2 -1
  266. package/jest/react-native-env.js +1 -3
  267. package/jest/setup.js +11 -8
  268. package/overrides.json +115 -85
  269. package/package.json +38 -28
  270. package/rn-get-polyfills.js +1 -1
  271. package/src/Libraries/Components/TextInput/TextInput.Types.win32.ts +68 -0
  272. package/src/Libraries/Components/View/ViewAccessibility.win32.d.ts +5 -5
  273. package/src/Libraries/Components/View/ViewPropTypes.win32.d.ts +1 -1
  274. package/types/index.d.ts +2 -6
  275. package/types/modules/Codegen.d.ts +4 -4
  276. package/types/modules/globals.d.ts +27 -25
  277. package/types/public/DeprecatedPropertiesAlias.d.ts +0 -20
  278. package/types/public/ReactNativeRenderer.d.ts +2 -7
  279. package/Libraries/Animated/createAnimatedComponentInjection.js +0 -48
  280. package/Libraries/Animated/createAnimatedComponent_EXPERIMENTAL.js +0 -48
  281. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.flow.js +0 -208
  282. package/Libraries/Components/ActivityIndicator/ActivityIndicator.flow.js +0 -58
  283. package/Libraries/Components/DatePicker/DatePickerIOS.android.js +0 -47
  284. package/Libraries/Components/DatePicker/DatePickerIOS.d.ts +0 -92
  285. package/Libraries/Components/DatePicker/DatePickerIOS.flow.android.js +0 -14
  286. package/Libraries/Components/DatePicker/DatePickerIOS.flow.ios.js +0 -113
  287. package/Libraries/Components/DatePicker/DatePickerIOS.ios.js +0 -242
  288. package/Libraries/Components/DatePicker/DatePickerIOS.win32.js +0 -47
  289. package/Libraries/Components/DatePicker/RCTDatePickerNativeComponent.js +0 -60
  290. package/Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js +0 -26
  291. package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.android.js +0 -45
  292. package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.d.ts +0 -62
  293. package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js +0 -75
  294. package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.win32.js +0 -45
  295. package/Libraries/Components/ProgressViewIOS/RCTProgressViewNativeComponent.js +0 -33
  296. package/Libraries/Components/SafeAreaView/SafeAreaView.flow.js +0 -19
  297. package/Libraries/Components/Slider/Slider.d.ts +0 -132
  298. package/Libraries/Components/Slider/Slider.js +0 -282
  299. package/Libraries/Components/Slider/SliderNativeComponent.js +0 -56
  300. package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +0 -23
  301. package/Libraries/Interaction/Batchinator.js +0 -76
  302. package/Libraries/Interaction/BridgeSpyStallHandler.js +0 -63
  303. package/Libraries/Interaction/InteractionStallDebugger.js +0 -23
  304. package/Libraries/Interaction/PanResponder.flow.js +0 -257
  305. package/Libraries/Lists/CellRenderMask.js +0 -155
  306. package/Libraries/Lists/ChildListCollection.js +0 -72
  307. package/Libraries/Lists/StateSafePureComponent.js +0 -85
  308. package/Libraries/Lists/VirtualizedList.d.ts +0 -347
  309. package/Libraries/Lists/VirtualizedListCellRenderer.js +0 -259
  310. package/Libraries/Lists/VirtualizedListProps.js +0 -279
  311. package/Libraries/Performance/PureComponentDebug.js +0 -74
  312. package/Libraries/Reliability/UserFlow.js +0 -158
  313. package/Libraries/Renderer/implementations/ReactNativeRenderer.d.ts +0 -149
  314. package/Libraries/Renderer/shims/ReactNativeTypes.d.ts +0 -141
  315. package/Libraries/Utilities/MatrixMath.js +0 -748
  316. package/Libraries/Utilities/buildStyleInterpolator.js +0 -209
  317. package/Libraries/Utilities/clamp.js +0 -23
  318. package/Libraries/Utilities/deprecatedPropType.js +0 -36
  319. package/Libraries/Utilities/groupByEveryN.js +0 -51
  320. package/Libraries/Utilities/mergeIntoFast.js +0 -26
  321. package/Libraries/Utilities/setAndForwardRef.js +0 -71
  322. package/Libraries/Utilities/truncate.js +0 -51
  323. package/flow/JSITimerInternalType.js +0 -30
  324. package/flow/use-sync-external-store.js +0 -19
@@ -158,7 +158,7 @@ export interface PressableProps
158
158
  /**
159
159
  * Duration (in milliseconds) to wait after press down before calling onPressIn.
160
160
  */
161
- unstable_pressDelay?: number;
161
+ unstable_pressDelay?: number | undefined;
162
162
  }
163
163
 
164
164
  // TODO use React.AbstractComponent when available
@@ -188,7 +188,7 @@ type Props = $ReadOnly<{|
188
188
  */
189
189
  unstable_pressDelay?: ?number,
190
190
  /**
191
- * Web to Native Accessibilty props
191
+ * Web to Native Accessibility props
192
192
  * https://github.com/facebook/react-native/issues/34424
193
193
  */
194
194
  'aria-label'?: ?string,
@@ -183,6 +183,7 @@ class RefreshControl extends React.Component<RefreshControlProps> {
183
183
  _onRefresh = () => {
184
184
  this._lastNativeRefreshing = true;
185
185
 
186
+ // $FlowFixMe[unused-promise]
186
187
  this.props.onRefresh && this.props.onRefresh();
187
188
 
188
189
  // The native component will start refreshing so force an update to
@@ -9,7 +9,6 @@
9
9
  */
10
10
 
11
11
  import type {ViewProps} from '../View/ViewPropTypes';
12
- import type {SafeAreaViewType} from './SafeAreaView.flow';
13
12
 
14
13
  import Platform from '../../Utilities/Platform';
15
14
  import View from '../View/View';
@@ -32,4 +31,4 @@ if (Platform.OS === 'android') {
32
31
  exported = require('./RCTSafeAreaViewNativeComponent').default;
33
32
  }
34
33
 
35
- export default (exported: SafeAreaViewType);
34
+ export default exported;
@@ -9,7 +9,6 @@
9
9
  */
10
10
 
11
11
  import type {ViewProps} from '../View/ViewPropTypes';
12
- import type {SafeAreaViewType} from './SafeAreaView.flow';
13
12
 
14
13
  import Platform from '../../Utilities/Platform';
15
14
  import View from '../View/View';
@@ -33,4 +32,4 @@ if (Platform.OS === 'android' || Platform.OS === 'win32') {
33
32
  exported = require('./RCTSafeAreaViewNativeComponent').default;
34
33
  }
35
34
 
36
- export default (exported: SafeAreaViewType);
35
+ export default exported;
@@ -23,7 +23,7 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = {
23
23
  validAttributes: {
24
24
  decelerationRate: true,
25
25
  disableIntervalMomentum: true,
26
- endFillColor: {process: require('../../StyleSheet/processColor')},
26
+ endFillColor: {process: require('../../StyleSheet/processColor').default},
27
27
  fadingEdgeLength: true,
28
28
  nestedScrollEnabled: true,
29
29
  overScrollMode: true,
@@ -43,14 +43,20 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = {
43
43
  borderBottomRightRadius: true,
44
44
  borderRadius: true,
45
45
  borderStyle: true,
46
- borderRightColor: {process: require('../../StyleSheet/processColor')},
47
- borderColor: {process: require('../../StyleSheet/processColor')},
48
- borderBottomColor: {process: require('../../StyleSheet/processColor')},
46
+ borderRightColor: {
47
+ process: require('../../StyleSheet/processColor').default,
48
+ },
49
+ borderColor: {process: require('../../StyleSheet/processColor').default},
50
+ borderBottomColor: {
51
+ process: require('../../StyleSheet/processColor').default,
52
+ },
49
53
  borderTopLeftRadius: true,
50
- borderTopColor: {process: require('../../StyleSheet/processColor')},
54
+ borderTopColor: {process: require('../../StyleSheet/processColor').default},
51
55
  removeClippedSubviews: true,
52
56
  borderTopRightRadius: true,
53
- borderLeftColor: {process: require('../../StyleSheet/processColor')},
57
+ borderLeftColor: {
58
+ process: require('../../StyleSheet/processColor').default,
59
+ },
54
60
  pointerEvents: true,
55
61
  },
56
62
  };
@@ -730,7 +730,7 @@ export interface ScrollViewProps
730
730
  /**
731
731
  * When true, Sticky header is hidden when scrolling down, and dock at the top when scrolling up.
732
732
  */
733
- stickyHeaderHiddenOnScroll?: boolean;
733
+ stickyHeaderHiddenOnScroll?: boolean | undefined;
734
734
 
735
735
  /**
736
736
  * Style
@@ -841,7 +841,7 @@ export class ScrollView extends ScrollViewBase {
841
841
  * The options object has an animated prop, that enables the scrolling animation or not.
842
842
  * The animated prop defaults to true
843
843
  */
844
- scrollToEnd(options?: {animated?: boolean}): void;
844
+ scrollToEnd(options?: {animated?: boolean | undefined}): void;
845
845
 
846
846
  /**
847
847
  * Displays the scroll indicators momentarily.
@@ -33,7 +33,6 @@ import StyleSheet from '../../StyleSheet/StyleSheet';
33
33
  import Dimensions from '../../Utilities/Dimensions';
34
34
  import dismissKeyboard from '../../Utilities/dismissKeyboard';
35
35
  import Platform from '../../Utilities/Platform';
36
- import setAndForwardRef from '../../Utilities/setAndForwardRef';
37
36
  import Keyboard from '../Keyboard/Keyboard';
38
37
  import TextInputState from '../TextInput/TextInputState';
39
38
  import View from '../View/View';
@@ -46,6 +45,8 @@ import ScrollViewContext, {HORIZONTAL, VERTICAL} from './ScrollViewContext';
46
45
  import ScrollViewNativeComponent from './ScrollViewNativeComponent';
47
46
  import ScrollViewStickyHeader from './ScrollViewStickyHeader';
48
47
  import invariant from 'invariant';
48
+ import memoize from 'memoize-one';
49
+ import nullthrows from 'nullthrows';
49
50
  import * as React from 'react';
50
51
 
51
52
  if (Platform.OS === 'ios') {
@@ -165,6 +166,14 @@ export type ScrollViewImperativeMethods = $ReadOnly<{|
165
166
  export type DecelerationRateType = 'fast' | 'normal' | number;
166
167
  export type ScrollResponderType = ScrollViewImperativeMethods;
167
168
 
169
+ type NativeScrollViewInstance = React.ElementRef<HostComponent<mixed>>;
170
+ type PublicScrollViewInstance = $ReadOnly<{|
171
+ ...$Exact<NativeScrollViewInstance>,
172
+ ...ScrollViewImperativeMethods,
173
+ |}>;
174
+
175
+ type InnerViewInstance = React.ElementRef<typeof View>;
176
+
168
177
  type IOSProps = $ReadOnly<{|
169
178
  /**
170
179
  * Controls whether iOS should automatically adjust the content inset
@@ -279,7 +288,6 @@ type IOSProps = $ReadOnly<{|
279
288
  * visibility. Occlusion, transforms, and other complexity won't be taken into account as to
280
289
  * whether content is "visible" or not.
281
290
  *
282
- * @platform ios
283
291
  */
284
292
  maintainVisibleContentPosition?: ?$ReadOnly<{|
285
293
  minIndexForVisible: number,
@@ -301,24 +309,6 @@ type IOSProps = $ReadOnly<{|
301
309
  * @platform ios
302
310
  */
303
311
  pinchGestureEnabled?: ?boolean,
304
- /**
305
- * This controls how often the scroll event will be fired while scrolling
306
- * (as a time interval in ms). A lower number yields better accuracy for code
307
- * that is tracking the scroll position, but can lead to scroll performance
308
- * problems due to the volume of information being send over the bridge.
309
- *
310
- * Values between 0 and 17ms indicate 60fps updates are needed and throttling
311
- * will be disabled.
312
- *
313
- * If you do not need precise scroll position tracking, set this value higher
314
- * to limit the information being sent across the bridge.
315
- *
316
- * The default value is zero, which results in the scroll event being sent only
317
- * once each time the view is scrolled.
318
- *
319
- * @platform ios
320
- */
321
- scrollEventThrottle?: ?number,
322
312
  /**
323
313
  * The amount by which the scroll view indicators are inset from the edges
324
314
  * of the scroll view. This should normally be set to the same value as
@@ -560,7 +550,6 @@ export type Props = $ReadOnly<{|
560
550
  * Note: Vertical pagination is not supported on Android.
561
551
  */
562
552
  pagingEnabled?: ?boolean,
563
-
564
553
  /**
565
554
  * When false, the view cannot be scrolled via touch interaction.
566
555
  * The default value is true.
@@ -568,6 +557,22 @@ export type Props = $ReadOnly<{|
568
557
  * Note that the view can always be scrolled by calling `scrollTo`.
569
558
  */
570
559
  scrollEnabled?: ?boolean,
560
+ /**
561
+ * This controls how often the scroll event will be fired while scrolling
562
+ * (as a time interval in ms). A lower number yields better accuracy for code
563
+ * that is tracking the scroll position, but can lead to scroll performance
564
+ * problems due to the volume of information being send over the bridge.
565
+ *
566
+ * Values between 0 and 17ms indicate 60fps updates are needed and throttling
567
+ * will be disabled.
568
+ *
569
+ * If you do not need precise scroll position tracking, set this value higher
570
+ * to limit the information being sent across the bridge.
571
+ *
572
+ * The default value is zero, which results in the scroll event being sent only
573
+ * once each time the view is scrolled.
574
+ */
575
+ scrollEventThrottle?: ?number,
571
576
  /**
572
577
  * When true, shows a vertical scroll indicator.
573
578
  * The default value is true.
@@ -658,15 +663,13 @@ export type Props = $ReadOnly<{|
658
663
  * A ref to the inner View element of the ScrollView. This should be used
659
664
  * instead of calling `getInnerViewRef`.
660
665
  */
661
- innerViewRef?: React.Ref<typeof View>,
666
+ innerViewRef?: ForwardedRef<InnerViewInstance>,
662
667
  /**
663
668
  * A ref to the Native ScrollView component. This ref can be used to call
664
669
  * all of ScrollView's public methods, in addition to native methods like
665
670
  * measure, measureLayout, etc.
666
671
  */
667
- scrollViewRef?: React.Ref<
668
- typeof ScrollViewNativeComponent & ScrollViewImperativeMethods,
669
- >,
672
+ scrollViewRef?: ForwardedRef<PublicScrollViewInstance>,
670
673
  |}>;
671
674
 
672
675
  type State = {|
@@ -747,7 +750,7 @@ class ScrollView extends React.Component<Props, State> {
747
750
  _becameResponderWhileAnimating: boolean = false;
748
751
  _preventNegativeScrollOffset: ?boolean = null;
749
752
 
750
- _animated = null;
753
+ _animated: ?boolean = null;
751
754
 
752
755
  _subscriptionKeyboardWillShow: ?EventSubscription = null;
753
756
  _subscriptionKeyboardWillHide: ?EventSubscription = null;
@@ -826,36 +829,6 @@ class ScrollView extends React.Component<Props, State> {
826
829
  }
827
830
  }
828
831
 
829
- _setNativeRef: $FlowFixMe = setAndForwardRef({
830
- getForwardedRef: () => this.props.scrollViewRef,
831
- setLocalRef: ref => {
832
- this._scrollViewRef = ref;
833
-
834
- /*
835
- This is a hack. Ideally we would forwardRef to the underlying
836
- host component. However, since ScrollView has it's own methods that can be
837
- called as well, if we used the standard forwardRef then these
838
- methods wouldn't be accessible and thus be a breaking change.
839
-
840
- Therefore we edit ref to include ScrollView's public methods so that
841
- they are callable from the ref.
842
- */
843
- if (ref) {
844
- ref.getScrollResponder = this.getScrollResponder;
845
- ref.getScrollableNode = this.getScrollableNode;
846
- ref.getInnerViewNode = this.getInnerViewNode;
847
- ref.getInnerViewRef = this.getInnerViewRef;
848
- ref.getNativeScrollRef = this.getNativeScrollRef;
849
- ref.scrollTo = this.scrollTo;
850
- ref.scrollToEnd = this.scrollToEnd;
851
- ref.flashScrollIndicators = this.flashScrollIndicators;
852
- ref.scrollResponderZoomTo = this.scrollResponderZoomTo;
853
- ref.scrollResponderScrollNativeHandleToKeyboard =
854
- this.scrollResponderScrollNativeHandleToKeyboard;
855
- }
856
- },
857
- });
858
-
859
832
  /**
860
833
  * Returns a reference to the underlying scroll responder, which supports
861
834
  * operations like `scrollTo`. All ScrollView-like components should
@@ -868,19 +841,19 @@ class ScrollView extends React.Component<Props, State> {
868
841
  };
869
842
 
870
843
  getScrollableNode: () => ?number = () => {
871
- return findNodeHandle(this._scrollViewRef);
844
+ return findNodeHandle(this._scrollView.nativeInstance);
872
845
  };
873
846
 
874
847
  getInnerViewNode: () => ?number = () => {
875
- return findNodeHandle(this._innerViewRef);
848
+ return findNodeHandle(this._innerView.nativeInstance);
876
849
  };
877
850
 
878
- getInnerViewRef: () => ?React.ElementRef<typeof View> = () => {
879
- return this._innerViewRef;
851
+ getInnerViewRef: () => InnerViewInstance | null = () => {
852
+ return this._innerView.nativeInstance;
880
853
  };
881
854
 
882
- getNativeScrollRef: () => ?React.ElementRef<HostComponent<mixed>> = () => {
883
- return this._scrollViewRef;
855
+ getNativeScrollRef: () => NativeScrollViewInstance | null = () => {
856
+ return this._scrollView.nativeInstance;
884
857
  };
885
858
 
886
859
  /**
@@ -931,10 +904,15 @@ class ScrollView extends React.Component<Props, State> {
931
904
  x = options.x;
932
905
  animated = options.animated;
933
906
  }
934
- if (this._scrollViewRef == null) {
907
+ if (this._scrollView.nativeInstance == null) {
935
908
  return;
936
909
  }
937
- Commands.scrollTo(this._scrollViewRef, x || 0, y || 0, animated !== false);
910
+ Commands.scrollTo(
911
+ this._scrollView.nativeInstance,
912
+ x || 0,
913
+ y || 0,
914
+ animated !== false,
915
+ );
938
916
  };
939
917
 
940
918
  /**
@@ -950,10 +928,10 @@ class ScrollView extends React.Component<Props, State> {
950
928
  ) => {
951
929
  // Default to true
952
930
  const animated = (options && options.animated) !== false;
953
- if (this._scrollViewRef == null) {
931
+ if (this._scrollView.nativeInstance == null) {
954
932
  return;
955
933
  }
956
- Commands.scrollToEnd(this._scrollViewRef, animated);
934
+ Commands.scrollToEnd(this._scrollView.nativeInstance, animated);
957
935
  };
958
936
 
959
937
  /**
@@ -962,10 +940,10 @@ class ScrollView extends React.Component<Props, State> {
962
940
  * @platform ios
963
941
  */
964
942
  flashScrollIndicators: () => void = () => {
965
- if (this._scrollViewRef == null) {
943
+ if (this._scrollView.nativeInstance == null) {
966
944
  return;
967
945
  }
968
- Commands.flashScrollIndicators(this._scrollViewRef);
946
+ Commands.flashScrollIndicators(this._scrollView.nativeInstance);
969
947
  };
970
948
 
971
949
  /**
@@ -990,21 +968,21 @@ class ScrollView extends React.Component<Props, State> {
990
968
  this._additionalScrollOffset = additionalOffset || 0;
991
969
  this._preventNegativeScrollOffset = !!preventNegativeScrollOffset;
992
970
 
993
- if (this._innerViewRef == null) {
971
+ if (this._innerView.nativeInstance == null) {
994
972
  return;
995
973
  }
996
974
 
997
975
  if (typeof nodeHandle === 'number') {
998
976
  UIManager.measureLayout(
999
977
  nodeHandle,
1000
- findNodeHandle(this),
978
+ nullthrows(findNodeHandle(this)),
1001
979
  // $FlowFixMe[method-unbinding] added when improving typing for this parameters
1002
980
  this._textInputFocusError,
1003
981
  this._inputMeasureAndScrollToKeyboard,
1004
982
  );
1005
983
  } else {
1006
984
  nodeHandle.measureLayout(
1007
- this._innerViewRef,
985
+ this._innerView.nativeInstance,
1008
986
  this._inputMeasureAndScrollToKeyboard,
1009
987
  // $FlowFixMe[method-unbinding] added when improving typing for this parameters
1010
988
  this._textInputFocusError,
@@ -1047,10 +1025,14 @@ class ScrollView extends React.Component<Props, State> {
1047
1025
  );
1048
1026
  }
1049
1027
 
1050
- if (this._scrollViewRef == null) {
1028
+ if (this._scrollView.nativeInstance == null) {
1051
1029
  return;
1052
1030
  }
1053
- Commands.zoomToRect(this._scrollViewRef, rect, animated !== false);
1031
+ Commands.zoomToRect(
1032
+ this._scrollView.nativeInstance,
1033
+ rect,
1034
+ animated !== false,
1035
+ );
1054
1036
  };
1055
1037
 
1056
1038
  _textInputFocusError() {
@@ -1123,7 +1105,7 @@ class ScrollView extends React.Component<Props, State> {
1123
1105
  ) {
1124
1106
  this._scrollAnimatedValueAttachment =
1125
1107
  AnimatedImplementation.attachNativeEvent(
1126
- this._scrollViewRef,
1108
+ this._scrollView.nativeInstance,
1127
1109
  'onScroll',
1128
1110
  [{nativeEvent: {contentOffset: {y: this._scrollAnimatedValue}}}],
1129
1111
  );
@@ -1146,7 +1128,7 @@ class ScrollView extends React.Component<Props, State> {
1146
1128
  if (!stickyHeaderIndices) {
1147
1129
  return;
1148
1130
  }
1149
- const childArray = React.Children.toArray(this.props.children);
1131
+ const childArray = React.Children.toArray<$FlowFixMe>(this.props.children);
1150
1132
  if (key !== this._getKeyForIndex(index, childArray)) {
1151
1133
  // ignore stale layout update
1152
1134
  return;
@@ -1202,15 +1184,45 @@ class ScrollView extends React.Component<Props, State> {
1202
1184
  this.props.onContentSizeChange(width, height);
1203
1185
  };
1204
1186
 
1205
- _scrollViewRef: ?React.ElementRef<HostComponent<mixed>> = null;
1187
+ _innerView: RefForwarder<InnerViewInstance, InnerViewInstance> =
1188
+ createRefForwarder(
1189
+ (instance: InnerViewInstance): InnerViewInstance => instance,
1190
+ );
1191
+
1192
+ _scrollView: RefForwarder<
1193
+ NativeScrollViewInstance,
1194
+ PublicScrollViewInstance,
1195
+ > = createRefForwarder(
1196
+ (nativeInstance: NativeScrollViewInstance): PublicScrollViewInstance => {
1197
+ // This is a hack. Ideally we would forwardRef to the underlying
1198
+ // host component. However, since ScrollView has it's own methods that can be
1199
+ // called as well, if we used the standard forwardRef then these
1200
+ // methods wouldn't be accessible and thus be a breaking change.
1201
+ //
1202
+ // Therefore we edit ref to include ScrollView's public methods so that
1203
+ // they are callable from the ref.
1204
+
1205
+ // $FlowFixMe[prop-missing] - Known issue with appending custom methods.
1206
+ const publicInstance: PublicScrollViewInstance = Object.assign(
1207
+ nativeInstance,
1208
+ {
1209
+ getScrollResponder: this.getScrollResponder,
1210
+ getScrollableNode: this.getScrollableNode,
1211
+ getInnerViewNode: this.getInnerViewNode,
1212
+ getInnerViewRef: this.getInnerViewRef,
1213
+ getNativeScrollRef: this.getNativeScrollRef,
1214
+ scrollTo: this.scrollTo,
1215
+ scrollToEnd: this.scrollToEnd,
1216
+ flashScrollIndicators: this.flashScrollIndicators,
1217
+ scrollResponderZoomTo: this.scrollResponderZoomTo,
1218
+ scrollResponderScrollNativeHandleToKeyboard:
1219
+ this.scrollResponderScrollNativeHandleToKeyboard,
1220
+ },
1221
+ );
1206
1222
 
1207
- _innerViewRef: ?React.ElementRef<typeof View> = null;
1208
- _setInnerViewRef: $FlowFixMe = setAndForwardRef({
1209
- getForwardedRef: () => this.props.innerViewRef,
1210
- setLocalRef: ref => {
1211
- this._innerViewRef = ref;
1223
+ return publicInstance;
1212
1224
  },
1213
- });
1225
+ );
1214
1226
 
1215
1227
  /**
1216
1228
  * Warning, this may be called several times for a single keyboard opening.
@@ -1650,6 +1662,7 @@ class ScrollView extends React.Component<Props, State> {
1650
1662
  this.props.contentContainerStyle,
1651
1663
  ];
1652
1664
  if (__DEV__ && this.props.style !== undefined) {
1665
+ // $FlowFixMe[underconstrained-implicit-instantiation]
1653
1666
  const style = flattenStyle(this.props.style);
1654
1667
  const childLayoutProps = ['alignItems', 'justifyContent'].filter(
1655
1668
  prop => style && style[prop] !== undefined,
@@ -1673,7 +1686,9 @@ class ScrollView extends React.Component<Props, State> {
1673
1686
  let children = this.props.children;
1674
1687
 
1675
1688
  if (stickyHeaderIndices != null && stickyHeaderIndices.length > 0) {
1676
- const childArray = React.Children.toArray(this.props.children);
1689
+ const childArray = React.Children.toArray<$FlowFixMe>(
1690
+ this.props.children,
1691
+ );
1677
1692
 
1678
1693
  children = childArray.map((child, index) => {
1679
1694
  const indexOfIndex = child ? stickyHeaderIndices.indexOf(index) : -1;
@@ -1716,7 +1731,7 @@ class ScrollView extends React.Component<Props, State> {
1716
1731
  const contentContainer = (
1717
1732
  <NativeDirectionalScrollContentView
1718
1733
  {...contentSizeChangeProps}
1719
- ref={this._setInnerViewRef}
1734
+ ref={this._innerView.getForwardingRef(this.props.innerViewRef)}
1720
1735
  style={contentContainerStyle}
1721
1736
  removeClippedSubviews={
1722
1737
  // Subview clipping causes issues with sticky headers on Android and
@@ -1802,12 +1817,15 @@ class ScrollView extends React.Component<Props, State> {
1802
1817
  }
1803
1818
 
1804
1819
  const refreshControl = this.props.refreshControl;
1820
+ const scrollViewRef = this._scrollView.getForwardingRef(
1821
+ this.props.scrollViewRef,
1822
+ );
1805
1823
 
1806
1824
  if (refreshControl) {
1807
1825
  if (Platform.OS === 'ios') {
1808
1826
  // On iOS the RefreshControl is a child of the ScrollView.
1809
1827
  return (
1810
- <NativeDirectionalScrollView {...props} ref={this._setNativeRef}>
1828
+ <NativeDirectionalScrollView {...props} ref={scrollViewRef}>
1811
1829
  {refreshControl}
1812
1830
  {contentContainer}
1813
1831
  </NativeDirectionalScrollView>
@@ -1818,6 +1836,7 @@ class ScrollView extends React.Component<Props, State> {
1818
1836
  // AndroidSwipeRefreshLayout and use flex: 1 for the ScrollView.
1819
1837
  // Note: we should split props.style on the inner and outer props
1820
1838
  // however, the ScrollView still needs the baseStyle to be scrollable
1839
+ // $FlowFixMe[underconstrained-implicit-instantiation]
1821
1840
  const {outer, inner} = splitLayoutProps(flattenStyle(props.style));
1822
1841
  return React.cloneElement(
1823
1842
  refreshControl,
@@ -1825,14 +1844,14 @@ class ScrollView extends React.Component<Props, State> {
1825
1844
  <NativeDirectionalScrollView
1826
1845
  {...props}
1827
1846
  style={StyleSheet.compose(baseStyle, inner)}
1828
- ref={this._setNativeRef}>
1847
+ ref={scrollViewRef}>
1829
1848
  {contentContainer}
1830
1849
  </NativeDirectionalScrollView>,
1831
1850
  );
1832
1851
  }
1833
1852
  }
1834
1853
  return (
1835
- <NativeDirectionalScrollView {...props} ref={this._setNativeRef}>
1854
+ <NativeDirectionalScrollView {...props} ref={scrollViewRef}>
1836
1855
  {contentContainer}
1837
1856
  </NativeDirectionalScrollView>
1838
1857
  );
@@ -1857,6 +1876,48 @@ const styles = StyleSheet.create({
1857
1876
  },
1858
1877
  });
1859
1878
 
1879
+ type ForwardedRef<T> = {current: null | T, ...} | ((null | T) => mixed);
1880
+
1881
+ type RefForwarder<TNativeInstance, TPublicInstance> = {
1882
+ getForwardingRef: (
1883
+ ?ForwardedRef<TPublicInstance>,
1884
+ ) => (TNativeInstance | null) => void,
1885
+ nativeInstance: TNativeInstance | null,
1886
+ publicInstance: TPublicInstance | null,
1887
+ };
1888
+
1889
+ /**
1890
+ * Helper function that should be replaced with `useCallback` and `useMergeRefs`
1891
+ * once `ScrollView` is reimplemented as a functional component.
1892
+ */
1893
+ function createRefForwarder<TNativeInstance, TPublicInstance>(
1894
+ mutator: TNativeInstance => TPublicInstance,
1895
+ ): RefForwarder<TNativeInstance, TPublicInstance> {
1896
+ const state: RefForwarder<TNativeInstance, TPublicInstance> = {
1897
+ getForwardingRef: memoize(forwardedRef => {
1898
+ return (nativeInstance: TNativeInstance | null): void => {
1899
+ const publicInstance =
1900
+ nativeInstance == null ? null : mutator(nativeInstance);
1901
+
1902
+ state.nativeInstance = nativeInstance;
1903
+ state.publicInstance = publicInstance;
1904
+
1905
+ if (forwardedRef != null) {
1906
+ if (typeof forwardedRef === 'function') {
1907
+ forwardedRef(publicInstance);
1908
+ } else {
1909
+ forwardedRef.current = publicInstance;
1910
+ }
1911
+ }
1912
+ };
1913
+ }),
1914
+ nativeInstance: null,
1915
+ publicInstance: null,
1916
+ };
1917
+
1918
+ return state;
1919
+ }
1920
+
1860
1921
  /* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
1861
1922
  * LTI update could not be added via codemod */
1862
1923
  function Wrapper(props, ref: (mixed => mixed) | {current: mixed, ...}) {
@@ -1872,9 +1933,6 @@ ForwardedScrollView.displayName = 'ScrollView';
1872
1933
 
1873
1934
  module.exports = ((ForwardedScrollView: $FlowFixMe): React.AbstractComponent<
1874
1935
  React.ElementConfig<typeof ScrollView>,
1875
- $ReadOnly<{|
1876
- ...$Exact<React.ElementRef<HostComponent<mixed>>>,
1877
- ...ScrollViewImperativeMethods,
1878
- |}>,
1936
+ PublicScrollViewInstance,
1879
1937
  > &
1880
1938
  ScrollViewComponentStatics);