@office-iss/react-native-win32 0.74.4 → 0.75.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 (206) hide show
  1. package/.flowconfig +9 -4
  2. package/CHANGELOG.json +554 -51
  3. package/CHANGELOG.md +165 -30
  4. package/Libraries/Animated/AnimatedImplementation.js +2 -0
  5. package/Libraries/Animated/NativeAnimatedHelper.js +4 -0
  6. package/Libraries/Animated/NativeAnimatedHelper.win32.js +4 -0
  7. package/Libraries/Animated/createAnimatedComponent.js +10 -4
  8. package/Libraries/Animated/useAnimatedProps.js +56 -28
  9. package/Libraries/BatchedBridge/MessageQueue.js +1 -0
  10. package/Libraries/Components/Button.js +10 -5
  11. package/Libraries/Components/Button.win32.js +1 -0
  12. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +11 -2
  13. package/Libraries/Components/Pressable/Pressable.js +13 -6
  14. package/Libraries/Components/Pressable/Pressable.win32.js +13 -6
  15. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +4 -0
  16. package/Libraries/Components/ScrollView/ScrollView.js +109 -29
  17. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +6 -0
  18. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +13 -1
  19. package/Libraries/Components/StatusBar/StatusBar.js +1 -21
  20. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +0 -15
  21. package/Libraries/Components/TextInput/InputAccessoryView.js +10 -1
  22. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +0 -12
  23. package/Libraries/Components/TextInput/TextInput.d.ts +0 -19
  24. package/Libraries/Components/TextInput/TextInput.js +14 -70
  25. package/Libraries/Components/TextInput/TextInput.win32.js +15 -72
  26. package/Libraries/Components/Touchable/Touchable.js +2 -2
  27. package/Libraries/Components/Touchable/TouchableHighlight.d.ts +4 -10
  28. package/Libraries/Components/Touchable/TouchableHighlight.js +3 -1
  29. package/Libraries/Components/Touchable/TouchableOpacity.d.ts +4 -32
  30. package/Libraries/Components/Touchable/TouchableOpacity.js +3 -1
  31. package/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts +8 -0
  32. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +117 -111
  33. package/Libraries/Components/View/ReactNativeStyleAttributes.js +6 -0
  34. package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
  35. package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +1 -0
  36. package/Libraries/Components/View/View.js +0 -11
  37. package/Libraries/Components/View/View.win32.js +0 -11
  38. package/Libraries/Components/View/ViewAccessibility.js +4 -4
  39. package/Libraries/Components/View/ViewAccessibility.win32.js +6 -6
  40. package/Libraries/Components/View/ViewPropTypes.d.ts +7 -49
  41. package/Libraries/Components/View/ViewPropTypes.js +7 -0
  42. package/Libraries/Components/View/ViewPropTypes.win32.js +7 -0
  43. package/Libraries/Core/Devtools/loadBundleFromServer.js +3 -3
  44. package/Libraries/Core/Devtools/loadBundleFromServer.win32.js +153 -0
  45. package/Libraries/Core/Devtools/parseErrorStack.js +5 -5
  46. package/Libraries/Core/Devtools/parseHermesStack.js +22 -16
  47. package/Libraries/Core/ErrorHandlers.js +116 -0
  48. package/Libraries/Core/ExceptionsManager.js +2 -2
  49. package/Libraries/Core/ReactNativeVersion.js +3 -3
  50. package/Libraries/Core/setUpDeveloperTools.js +3 -1
  51. package/Libraries/Core/setUpPerformance.js +6 -4
  52. package/Libraries/Core/setUpReactDevTools.js +70 -10
  53. package/Libraries/Core/setUpTimers.js +50 -31
  54. package/Libraries/Debugging/DebuggingOverlayRegistry.js +1 -1
  55. package/Libraries/Image/Image.android.js +23 -13
  56. package/Libraries/Image/Image.d.ts +14 -15
  57. package/Libraries/Image/Image.ios.js +21 -11
  58. package/Libraries/Image/Image.win32.js +5 -3
  59. package/Libraries/Image/ImageProps.js +16 -5
  60. package/Libraries/Image/ImageTypes.flow.js +7 -2
  61. package/Libraries/Image/ImageUtils.js +1 -0
  62. package/Libraries/Image/ImageViewNativeComponent.js +2 -1
  63. package/Libraries/Inspector/ElementBox.js +6 -3
  64. package/Libraries/Inspector/ElementProperties.js +1 -1
  65. package/Libraries/Interaction/TouchHistoryMath.js +4 -4
  66. package/Libraries/IntersectionObserver/IntersectionObserverManager.js +6 -26
  67. package/Libraries/JSInspector/NetworkAgent.js +1 -1
  68. package/Libraries/LogBox/Data/LogBoxData.js +39 -29
  69. package/Libraries/LogBox/Data/LogBoxLog.js +114 -2
  70. package/Libraries/LogBox/Data/parseLogBoxLog.js +168 -53
  71. package/Libraries/LogBox/LogBox.js +29 -12
  72. package/Libraries/LogBox/LogBoxNotificationContainer.js +4 -0
  73. package/Libraries/LogBox/UI/LogBoxInspector.js +8 -70
  74. package/Libraries/LogBox/UI/LogBoxInspectorBody.js +87 -0
  75. package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +6 -42
  76. package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +58 -0
  77. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +5 -66
  78. package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +8 -52
  79. package/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +76 -0
  80. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +8 -5
  81. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.win32.js +8 -5
  82. package/Libraries/LogBox/UI/LogBoxNotification.js +13 -152
  83. package/Libraries/LogBox/UI/LogBoxNotificationCountBadge.js +63 -0
  84. package/Libraries/LogBox/UI/LogBoxNotificationDismissButton.js +67 -0
  85. package/Libraries/LogBox/UI/LogBoxNotificationMessage.js +57 -0
  86. package/Libraries/NativeComponent/BaseViewConfig.android.js +5 -0
  87. package/Libraries/NativeComponent/BaseViewConfig.ios.js +5 -0
  88. package/Libraries/NativeComponent/BaseViewConfig.win32.js +5 -0
  89. package/Libraries/NativeComponent/NativeComponentRegistry.js +12 -5
  90. package/Libraries/NativeComponent/StaticViewConfigValidator.js +3 -0
  91. package/Libraries/Network/XMLHttpRequest.js +5 -1
  92. package/Libraries/NewAppScreen/components/LearnMoreLinks.js +3 -3
  93. package/Libraries/Pressability/Pressability.js +3 -51
  94. package/Libraries/Pressability/Pressability.win32.js +3 -51
  95. package/Libraries/ReactNative/AppContainer-dev.js +3 -2
  96. package/Libraries/ReactNative/AppContainer-prod.js +2 -1
  97. package/Libraries/ReactNative/AppContainer.js +2 -0
  98. package/Libraries/ReactNative/AppRegistry.d.ts +7 -0
  99. package/Libraries/ReactNative/AppRegistry.js +10 -4
  100. package/Libraries/ReactNative/BridgelessUIManager.js +1 -21
  101. package/Libraries/ReactNative/FabricUIManager.js +0 -51
  102. package/Libraries/ReactNative/ReactFabricPublicInstance/warnForStyleProps.js +1 -0
  103. package/Libraries/ReactNative/RendererImplementation.js +20 -2
  104. package/Libraries/ReactNative/UIManager.d.ts +0 -21
  105. package/Libraries/ReactNative/UIManagerProperties.js +0 -3
  106. package/Libraries/ReactNative/__mocks__/FabricUIManager.js +5 -341
  107. package/Libraries/ReactNative/getNativeComponentAttributes.js +8 -8
  108. package/Libraries/ReactNative/renderApplication.js +3 -0
  109. package/Libraries/Renderer/implementations/ReactFabric-dev.js +15682 -27088
  110. package/Libraries/Renderer/implementations/ReactFabric-prod.js +5082 -4381
  111. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3480 -2571
  112. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +15943 -27543
  113. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +5303 -4606
  114. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +3450 -2572
  115. package/Libraries/Renderer/shims/ReactFabric.js +2 -2
  116. package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -2
  117. package/Libraries/Renderer/shims/ReactNative.js +2 -3
  118. package/Libraries/Renderer/shims/ReactNativeTypes.js +24 -3
  119. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +2 -2
  120. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
  121. package/Libraries/Share/Share.d.ts +16 -10
  122. package/Libraries/Share/Share.js +14 -15
  123. package/Libraries/StyleSheet/StyleSheet.d.ts +1 -1
  124. package/Libraries/StyleSheet/StyleSheet.js +3 -10
  125. package/Libraries/StyleSheet/StyleSheet.win32.js +3 -10
  126. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +21 -21
  127. package/Libraries/StyleSheet/StyleSheetTypes.js +24 -18
  128. package/Libraries/StyleSheet/flattenStyle.js +1 -0
  129. package/Libraries/StyleSheet/processFilter.js +132 -0
  130. package/Libraries/StyleSheet/processTransform.js +18 -3
  131. package/Libraries/Text/Text.js +151 -128
  132. package/Libraries/Text/Text.win32.js +163 -138
  133. package/Libraries/Text/TextNativeComponent.js +5 -4
  134. package/Libraries/Text/TextNativeComponent.win32.js +5 -4
  135. package/Libraries/Text/TextProps.js +6 -6
  136. package/Libraries/Text/TextProps.win32.js +6 -6
  137. package/Libraries/TurboModule/TurboModuleRegistry.js +2 -1
  138. package/Libraries/Types/CodegenTypes.js +3 -0
  139. package/Libraries/Utilities/{LoadingView.android.js → DevLoadingView.js} +33 -11
  140. package/Libraries/Utilities/Dimensions.js +1 -0
  141. package/Libraries/Utilities/Dimensions.win32.js +1 -0
  142. package/Libraries/Utilities/HMRClient.js +36 -8
  143. package/Libraries/Utilities/HMRClientProdShim.js +1 -0
  144. package/Libraries/Utilities/Platform.android.js +4 -4
  145. package/Libraries/Utilities/RCTLog.js +1 -0
  146. package/Libraries/Utilities/ReactNativeTestTools.js +12 -24
  147. package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +11 -6
  148. package/Libraries/__tests__/ButtonWin32-test.js +7 -6
  149. package/Libraries/promiseRejectionTrackingOptions.js +1 -0
  150. package/jest/mockComponent.js +7 -0
  151. package/jest/renderer.js +25 -14
  152. package/jest/setup.js +19 -13
  153. package/jest.config.js +2 -1
  154. package/overrides.json +30 -29
  155. package/package.json +27 -25
  156. package/rn-get-polyfills.js +1 -0
  157. package/src/private/core/composeStyles.js +27 -0
  158. package/src/private/featureflags/ReactNativeFeatureFlags.js +93 -33
  159. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +23 -4
  160. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +56 -0
  161. package/src/private/fusebox/setUpFuseboxReactDevToolsDispatcher.js +108 -0
  162. package/src/private/specs/modules/NativeBlobModule.js +4 -2
  163. package/src/private/specs/modules/NativeDevSettings.js +1 -0
  164. package/src/private/specs/modules/NativePushNotificationManagerIOS.js +0 -4
  165. package/src/private/specs/modules/NativeUIManager.js +0 -7
  166. package/src/private/webapis/dom/geometry/DOMRectReadOnly.js +24 -24
  167. package/src/private/webapis/dom/nodes/ReactNativeElement.js +11 -14
  168. package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +2 -3
  169. package/src/private/webapis/dom/nodes/ReadOnlyElement.js +24 -54
  170. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +5 -13
  171. package/src/private/webapis/dom/nodes/specs/NativeDOM.js +468 -0
  172. package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +413 -0
  173. package/src/private/webapis/dom/oldstylecollections/DOMRectList.js +4 -4
  174. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +4 -4
  175. package/src/private/webapis/dom/oldstylecollections/NodeList.js +5 -5
  176. package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +34 -0
  177. package/src/private/webapis/microtasks/specs/NativeMicrotasks.js +21 -0
  178. package/src/private/webapis/performance/EventCounts.js +1 -1
  179. package/src/private/webapis/performance/MemoryInfo.js +9 -9
  180. package/src/private/webapis/performance/Performance.js +10 -56
  181. package/src/private/webapis/performance/PerformanceObserver.js +30 -22
  182. package/src/private/webapis/performance/RawPerformanceEntry.js +2 -7
  183. package/src/private/webapis/performance/ReactNativeStartupTiming.js +18 -18
  184. package/src/private/webapis/performance/UserTiming.js +63 -0
  185. package/src/private/webapis/performance/{NativePerformance.js → specs/NativePerformance.js} +3 -2
  186. package/src/private/webapis/performance/{NativePerformanceObserver.js → specs/NativePerformanceObserver.js} +2 -2
  187. package/src/private/webapis/performance/{__mocks__ → specs/__mocks__}/NativePerformance.js +1 -1
  188. package/src/private/webapis/performance/{__mocks__ → specs/__mocks__}/NativePerformanceObserver.js +3 -4
  189. package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +7 -49
  190. package/types/modules/globals.d.ts +4 -0
  191. package/Libraries/Components/ScrollView/ScrollView.win32.js +0 -1915
  192. package/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js +0 -13
  193. package/Libraries/Utilities/LoadingView.ios.js +0 -50
  194. package/Libraries/Utilities/LoadingView.js +0 -16
  195. package/jest/ReactNativeInternalFeatureFlagsMock.js +0 -13
  196. package/src/private/featureflags/NativeReactNativeFeatureFlags.js +0 -44
  197. package/src/private/featureflags/__tests__/ReactNativeFeatureFlags-test.js +0 -92
  198. package/src/private/specs/modules/NativeAnimationsDebugModule.js +0 -20
  199. package/src/private/webapis/dom/oldstylecollections/__tests__/DOMRectList-test.js +0 -85
  200. package/src/private/webapis/dom/oldstylecollections/__tests__/HTMLCollection-test.js +0 -80
  201. package/src/private/webapis/dom/oldstylecollections/__tests__/NodeList-test.js +0 -161
  202. package/src/private/webapis/performance/__tests__/EventCounts-test.js +0 -116
  203. package/src/private/webapis/performance/__tests__/NativePerformanceMock-test.js +0 -82
  204. package/src/private/webapis/performance/__tests__/NativePerformanceObserverMock-test.js +0 -108
  205. package/src/private/webapis/performance/__tests__/Performance-test.js +0 -117
  206. package/src/private/webapis/performance/__tests__/PerformanceObserver-test.js +0 -208
@@ -23,13 +23,17 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = {
23
23
  validAttributes: {
24
24
  decelerationRate: true,
25
25
  disableIntervalMomentum: true,
26
+ maintainVisibleContentPosition: true,
26
27
  endFillColor: {process: require('../../StyleSheet/processColor').default},
27
28
  fadingEdgeLength: true,
28
29
  nestedScrollEnabled: true,
29
30
  overScrollMode: true,
30
31
  pagingEnabled: true,
31
32
  persistentScrollbar: true,
33
+ horizontal: true,
34
+ enableSyncOnScroll: true,
32
35
  scrollEnabled: true,
36
+ scrollEventThrottle: true,
33
37
  scrollPerfTag: true,
34
38
  sendMomentumEvents: true,
35
39
  showsHorizontalScrollIndicator: true,
@@ -33,6 +33,7 @@ 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 EventEmitter from '../../vendor/emitter/EventEmitter';
36
37
  import Keyboard from '../Keyboard/Keyboard';
37
38
  import TextInputState from '../TextInput/TextInputState';
38
39
  import View from '../View/View';
@@ -266,33 +267,6 @@ type IOSProps = $ReadOnly<{|
266
267
  * @platform ios
267
268
  */
268
269
  canCancelContentTouches?: ?boolean,
269
- /**
270
- * When set, the scroll view will adjust the scroll position so that the first child that is
271
- * currently visible and at or beyond `minIndexForVisible` will not change position. This is
272
- * useful for lists that are loading content in both directions, e.g. a chat thread, where new
273
- * messages coming in might otherwise cause the scroll position to jump. A value of 0 is common,
274
- * but other values such as 1 can be used to skip loading spinners or other content that should
275
- * not maintain position.
276
- *
277
- * The optional `autoscrollToTopThreshold` can be used to make the content automatically scroll
278
- * to the top after making the adjustment if the user was within the threshold of the top before
279
- * the adjustment was made. This is also useful for chat-like applications where you want to see
280
- * new messages scroll into place, but not if the user has scrolled up a ways and it would be
281
- * disruptive to scroll a bunch.
282
- *
283
- * Caveat 1: Reordering elements in the scrollview with this enabled will probably cause
284
- * jumpiness and jank. It can be fixed, but there are currently no plans to do so. For now,
285
- * don't re-order the content of any ScrollViews or Lists that use this feature.
286
- *
287
- * Caveat 2: This simply uses `contentOffset` and `frame.origin` in native code to compute
288
- * visibility. Occlusion, transforms, and other complexity won't be taken into account as to
289
- * whether content is "visible" or not.
290
- *
291
- */
292
- maintainVisibleContentPosition?: ?$ReadOnly<{|
293
- minIndexForVisible: number,
294
- autoscrollToTopThreshold?: ?number,
295
- |}>,
296
270
  /**
297
271
  * The maximum allowed zoom scale. The default value is 1.0.
298
272
  * @platform ios
@@ -465,6 +439,20 @@ export type Props = $ReadOnly<{|
465
439
  * - `'fast'`: 0.99 on iOS, 0.9 on Android
466
440
  */
467
441
  decelerationRate?: ?DecelerationRateType,
442
+
443
+ /**
444
+ * *Experimental, iOS Only*. The API is experimental and will change in future releases.
445
+ *
446
+ * Controls how much distance is travelled after user stops scrolling.
447
+ * Value greater than 1 will increase the distance travelled.
448
+ * Value less than 1 will decrease the distance travelled.
449
+ *
450
+ * @deprecated
451
+ *
452
+ * The default value is 1.
453
+ */
454
+ experimental_endDraggingSensitivityMultiplier?: ?number,
455
+
468
456
  /**
469
457
  * When true, the scroll view's children are arranged horizontally in a row
470
458
  * instead of vertically in a column. The default value is false.
@@ -505,6 +493,33 @@ export type Props = $ReadOnly<{|
505
493
  * - `true`, deprecated, use 'always' instead
506
494
  */
507
495
  keyboardShouldPersistTaps?: ?('always' | 'never' | 'handled' | true | false),
496
+ /**
497
+ * When set, the scroll view will adjust the scroll position so that the first child that is
498
+ * partially or fully visible and at or beyond `minIndexForVisible` will not change position.
499
+ * This is useful for lists that are loading content in both directions, e.g. a chat thread,
500
+ * where new messages coming in might otherwise cause the scroll position to jump. A value of 0
501
+ * is common, but other values such as 1 can be used to skip loading spinners or other content
502
+ * that should not maintain position.
503
+ *
504
+ * The optional `autoscrollToTopThreshold` can be used to make the content automatically scroll
505
+ * to the top after making the adjustment if the user was within the threshold of the top before
506
+ * the adjustment was made. This is also useful for chat-like applications where you want to see
507
+ * new messages scroll into place, but not if the user has scrolled up a ways and it would be
508
+ * disruptive to scroll a bunch.
509
+ *
510
+ * Caveat 1: Reordering elements in the scrollview with this enabled will probably cause
511
+ * jumpiness and jank. It can be fixed, but there are currently no plans to do so. For now,
512
+ * don't re-order the content of any ScrollViews or Lists that use this feature.
513
+ *
514
+ * Caveat 2: This simply uses `contentOffset` and `frame.origin` in native code to compute
515
+ * visibility. Occlusion, transforms, and other complexity won't be taken into account as to
516
+ * whether content is "visible" or not.
517
+ *
518
+ */
519
+ maintainVisibleContentPosition?: ?$ReadOnly<{|
520
+ minIndexForVisible: number,
521
+ autoscrollToTopThreshold?: ?number,
522
+ |}>,
508
523
  /**
509
524
  * Called when the momentum scroll starts (scroll which occurs as the ScrollView glides to a stop).
510
525
  */
@@ -662,6 +677,9 @@ export type Props = $ReadOnly<{|
662
677
 
663
678
  type State = {|
664
679
  layoutHeight: ?number,
680
+ onScrollEmitter: ?EventEmitter<{
681
+ scroll: [{x: number, y: number}],
682
+ }>,
665
683
  |};
666
684
 
667
685
  const IS_ANIMATING_TOUCH_START_THRESHOLD_MS = 16;
@@ -747,6 +765,7 @@ class ScrollView extends React.Component<Props, State> {
747
765
 
748
766
  state: State = {
749
767
  layoutHeight: null,
768
+ onScrollEmitter: null,
750
769
  };
751
770
 
752
771
  componentDidMount() {
@@ -815,6 +834,8 @@ class ScrollView extends React.Component<Props, State> {
815
834
  if (this._scrollAnimatedValueAttachment) {
816
835
  this._scrollAnimatedValueAttachment.detach();
817
836
  }
837
+
838
+ this.state.onScrollEmitter?.removeAllListeners();
818
839
  }
819
840
 
820
841
  /**
@@ -934,6 +955,44 @@ class ScrollView extends React.Component<Props, State> {
934
955
  Commands.flashScrollIndicators(this._scrollView.nativeInstance);
935
956
  };
936
957
 
958
+ _subscribeToOnScroll: (
959
+ callback: ({x: number, y: number}) => void,
960
+ ) => EventSubscription = callback => {
961
+ // An undefined value means the listener has not been added, yet.
962
+ // A null value means the listener has been removed.
963
+ let subscription: ?EventSubscription;
964
+
965
+ this.setState(
966
+ ({onScrollEmitter}) => {
967
+ if (onScrollEmitter) {
968
+ return null;
969
+ } else {
970
+ return {onScrollEmitter: new EventEmitter()};
971
+ }
972
+ },
973
+ () => {
974
+ // If `subscription` is null, that means it was removed before we got
975
+ // here so do nothing.
976
+ if (subscription !== null) {
977
+ subscription = nullthrows(this.state.onScrollEmitter).addListener(
978
+ 'scroll',
979
+ callback,
980
+ );
981
+ }
982
+ },
983
+ );
984
+
985
+ return {
986
+ remove() {
987
+ // If `subscription` was created before this invocation, remove it.
988
+ subscription?.remove();
989
+ // Record this invocation by setting `subscription` to null, in case it
990
+ // ends up being created after this invocation.
991
+ subscription = null;
992
+ },
993
+ };
994
+ };
995
+
937
996
  /**
938
997
  * This method should be used as the callback to onFocus in a TextInputs'
939
998
  * parent view. Note that any module using this mixin needs to return
@@ -1140,6 +1199,11 @@ class ScrollView extends React.Component<Props, State> {
1140
1199
  _handleScroll = (e: ScrollEvent) => {
1141
1200
  this._observedScrollSinceBecomingResponder = true;
1142
1201
  this.props.onScroll && this.props.onScroll(e);
1202
+
1203
+ this.state.onScrollEmitter?.emit('scroll', {
1204
+ x: e.nativeEvent.contentOffset.x,
1205
+ y: e.nativeEvent.contentOffset.y,
1206
+ });
1143
1207
  };
1144
1208
 
1145
1209
  _handleLayout = (e: LayoutEvent) => {
@@ -1188,6 +1252,8 @@ class ScrollView extends React.Component<Props, State> {
1188
1252
  scrollToEnd: this.scrollToEnd,
1189
1253
  flashScrollIndicators: this.flashScrollIndicators,
1190
1254
  scrollResponderZoomTo: this.scrollResponderZoomTo,
1255
+ // TODO: Replace unstable_subscribeToOnScroll once scrollView.addEventListener('scroll', (e: ScrollEvent) => {}, {passive: false});
1256
+ unstable_subscribeToOnScroll: this._subscribeToOnScroll,
1191
1257
  scrollResponderScrollNativeHandleToKeyboard:
1192
1258
  this.scrollResponderScrollNativeHandleToKeyboard,
1193
1259
  },
@@ -1702,6 +1768,13 @@ class ScrollView extends React.Component<Props, State> {
1702
1768
  const hasStickyHeaders =
1703
1769
  Array.isArray(stickyHeaderIndices) && stickyHeaderIndices.length > 0;
1704
1770
 
1771
+ // Some ScrollView native component behaviors rely on using the metrics
1772
+ // of mounted views for anchoring. Make sure not to flatten children if
1773
+ // this is the case.
1774
+ const preserveChildren =
1775
+ this.props.maintainVisibleContentPosition != null ||
1776
+ (Platform.OS === 'android' && this.props.snapToAlignment != null);
1777
+
1705
1778
  const contentContainer = (
1706
1779
  <NativeDirectionalScrollContentView
1707
1780
  {...contentSizeChangeProps}
@@ -1714,7 +1787,8 @@ class ScrollView extends React.Component<Props, State> {
1714
1787
  ? false
1715
1788
  : this.props.removeClippedSubviews
1716
1789
  }
1717
- collapsable={false}>
1790
+ collapsable={false}
1791
+ collapsableChildren={!preserveChildren}>
1718
1792
  {children}
1719
1793
  </NativeDirectionalScrollContentView>
1720
1794
  );
@@ -1733,8 +1807,11 @@ class ScrollView extends React.Component<Props, State> {
1733
1807
  this.props.horizontal === true
1734
1808
  ? styles.baseHorizontal
1735
1809
  : styles.baseVertical;
1810
+
1811
+ const {experimental_endDraggingSensitivityMultiplier, ...otherProps} =
1812
+ this.props;
1736
1813
  const props = {
1737
- ...this.props,
1814
+ ...otherProps,
1738
1815
  alwaysBounceHorizontal,
1739
1816
  alwaysBounceVertical,
1740
1817
  style: StyleSheet.compose(baseStyle, this.props.style),
@@ -1759,6 +1836,9 @@ class ScrollView extends React.Component<Props, State> {
1759
1836
  onTouchStart: this._handleTouchStart,
1760
1837
  onTouchCancel: this._handleTouchCancel,
1761
1838
  onScroll: this._handleScroll,
1839
+ endDraggingSensitivityMultiplier:
1840
+ experimental_endDraggingSensitivityMultiplier,
1841
+ enableSyncOnScroll: this.state.onScrollEmitter ? true : undefined,
1762
1842
  scrollEventThrottle: hasStickyHeaders
1763
1843
  ? 1
1764
1844
  : this.props.scrollEventThrottle,
@@ -45,7 +45,9 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
45
45
  diff: require('../../Utilities/differ/pointsDiffer'),
46
46
  },
47
47
  decelerationRate: true,
48
+ enableSyncOnScroll: true, // Fabric only.
48
49
  disableIntervalMomentum: true,
50
+ maintainVisibleContentPosition: true,
49
51
  pagingEnabled: true,
50
52
  scrollEnabled: true,
51
53
  showsVerticalScrollIndicator: true,
@@ -59,6 +61,7 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
59
61
  sendMomentumEvents: true,
60
62
  borderRadius: true,
61
63
  nestedScrollEnabled: true,
64
+ scrollEventThrottle: true,
62
65
  borderStyle: true,
63
66
  borderRightColor: {
64
67
  process: require('../../StyleSheet/processColor').default,
@@ -70,6 +73,7 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
70
73
  process: require('../../StyleSheet/processColor').default,
71
74
  },
72
75
  persistentScrollbar: true,
76
+ horizontal: true,
73
77
  endFillColor: {
74
78
  process: require('../../StyleSheet/processColor').default,
75
79
  },
@@ -130,6 +134,8 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
130
134
  },
131
135
  contentInsetAdjustmentBehavior: true,
132
136
  decelerationRate: true,
137
+ endDraggingSensitivityMultiplier: true,
138
+ enableSyncOnScroll: true, // Fabric only.
133
139
  directionalLockEnabled: true,
134
140
  disableIntervalMomentum: true,
135
141
  indicatorStyle: true,
@@ -267,7 +267,16 @@ const ScrollViewStickyHeaderWithForwardedRef: React.AbstractComponent<
267
267
 
268
268
  const child = React.Children.only<$FlowFixMe>(props.children);
269
269
 
270
+ const passthroughAnimatedPropExplicitValues =
271
+ isFabric && translateY != null
272
+ ? {
273
+ style: {transform: [{translateY: translateY}]},
274
+ }
275
+ : null;
276
+
270
277
  return (
278
+ /* $FlowFixMe[prop-missing] passthroughAnimatedPropExplicitValues isn't properly
279
+ included in the Animated.View flow type. */
271
280
  <Animated.View
272
281
  collapsable={false}
273
282
  nativeID={props.nativeID}
@@ -277,7 +286,10 @@ const ScrollViewStickyHeaderWithForwardedRef: React.AbstractComponent<
277
286
  child.props.style,
278
287
  styles.header,
279
288
  {transform: [{translateY: animatedTranslateY}]},
280
- ]}>
289
+ ]}
290
+ passthroughAnimatedPropExplicitValues={
291
+ passthroughAnimatedPropExplicitValues
292
+ }>
281
293
  {React.cloneElement(child, {
282
294
  style: styles.fill, // We transfer the child style to the wrapper.
283
295
  onLayout: undefined, // we call this manually through our this._onLayout
@@ -163,29 +163,9 @@ function createStackEntry(props: any): any {
163
163
  /**
164
164
  * Component to control the app status bar.
165
165
  *
166
- * ### Usage with Navigator
167
- *
168
166
  * It is possible to have multiple `StatusBar` components mounted at the same
169
167
  * time. The props will be merged in the order the `StatusBar` components were
170
- * mounted. One use case is to specify status bar styles per route using `Navigator`.
171
- *
172
- * ```
173
- * <View>
174
- * <StatusBar
175
- * backgroundColor="blue"
176
- * barStyle="light-content"
177
- * />
178
- * <Navigator
179
- * initialRoute={{statusBarHidden: true}}
180
- * renderScene={(route, navigator) =>
181
- * <View>
182
- * <StatusBar hidden={route.statusBarHidden} />
183
- * ...
184
- * </View>
185
- * }
186
- * />
187
- * </View>
188
- * ```
168
+ * mounted.
189
169
  *
190
170
  * ### Imperative API
191
171
  *
@@ -385,15 +385,6 @@ export type NativeProps = $ReadOnly<{|
385
385
  |}>,
386
386
  >,
387
387
 
388
- onTextInput?: ?BubblingEventHandler<
389
- $ReadOnly<{|
390
- target: Int32,
391
- text: string,
392
- previousText: string,
393
- range: $ReadOnly<{|start: Double, end: Double|}>,
394
- |}>,
395
- >,
396
-
397
388
  /**
398
389
  * Callback that is called when text input ends.
399
390
  */
@@ -662,12 +653,6 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = {
662
653
  captured: 'onSubmitEditingCapture',
663
654
  },
664
655
  },
665
- topTextInput: {
666
- phasedRegistrationNames: {
667
- bubbled: 'onTextInput',
668
- captured: 'onTextInputCapture',
669
- },
670
- },
671
656
  },
672
657
  directEventTypes: {
673
658
  topScroll: {
@@ -8,11 +8,13 @@
8
8
  * @format
9
9
  */
10
10
 
11
+ import SafeAreaView from '../../Components/SafeAreaView/SafeAreaView';
11
12
  import StyleSheet, {
12
13
  type ColorValue,
13
14
  type ViewStyleProp,
14
15
  } from '../../StyleSheet/StyleSheet';
15
16
  import Platform from '../../Utilities/Platform';
17
+ import useWindowDimensions from '../../Utilities/useWindowDimensions';
16
18
  import RCTInputAccessoryViewNativeComponent from './RCTInputAccessoryViewNativeComponent';
17
19
  import * as React from 'react';
18
20
 
@@ -86,6 +88,8 @@ type Props = $ReadOnly<{|
86
88
  |}>;
87
89
 
88
90
  const InputAccessoryView: React.AbstractComponent<Props> = (props: Props) => {
91
+ const {width} = useWindowDimensions();
92
+
89
93
  if (Platform.OS === 'ios') {
90
94
  if (React.Children.count(props.children) === 0) {
91
95
  return null;
@@ -96,7 +100,9 @@ const InputAccessoryView: React.AbstractComponent<Props> = (props: Props) => {
96
100
  style={[props.style, styles.container]}
97
101
  nativeID={props.nativeID}
98
102
  backgroundColor={props.backgroundColor}>
99
- {props.children}
103
+ <SafeAreaView style={[styles.safeAreaView, {width}]}>
104
+ {props.children}
105
+ </SafeAreaView>
100
106
  </RCTInputAccessoryViewNativeComponent>
101
107
  );
102
108
  } else {
@@ -109,6 +115,9 @@ const styles = StyleSheet.create({
109
115
  container: {
110
116
  position: 'absolute',
111
117
  },
118
+ safeAreaView: {
119
+ flex: 1,
120
+ },
112
121
  });
113
122
 
114
123
  export default InputAccessoryView;
@@ -76,21 +76,12 @@ const RCTTextInputViewConfig = {
76
76
  },
77
77
  },
78
78
  directEventTypes: {
79
- topTextInput: {
80
- registrationName: 'onTextInput',
81
- },
82
- topKeyPressSync: {
83
- registrationName: 'onKeyPressSync',
84
- },
85
79
  topScroll: {
86
80
  registrationName: 'onScroll',
87
81
  },
88
82
  topSelectionChange: {
89
83
  registrationName: 'onSelectionChange',
90
84
  },
91
- topChangeSync: {
92
- registrationName: 'onChangeSync',
93
- },
94
85
  topContentSizeChange: {
95
86
  registrationName: 'onContentSizeChange',
96
87
  },
@@ -159,9 +150,6 @@ const RCTTextInputViewConfig = {
159
150
  onSelectionChange: true,
160
151
  onContentSizeChange: true,
161
152
  onScroll: true,
162
- onChangeSync: true,
163
- onKeyPressSync: true,
164
- onTextInput: true,
165
153
  }),
166
154
  },
167
155
  };
@@ -485,15 +485,6 @@ export interface TextInputSubmitEditingEventData {
485
485
  text: string;
486
486
  }
487
487
 
488
- /**
489
- * @see TextInputProps.onTextInput
490
- */
491
- export interface TextInputTextInputEventData {
492
- text: string;
493
- previousText: string;
494
- range: {start: number; end: number};
495
- }
496
-
497
488
  /**
498
489
  * @see https://reactnative.dev/docs/textinput#props
499
490
  */
@@ -787,16 +778,6 @@ export interface TextInputProps
787
778
  | ((e: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => void)
788
779
  | undefined;
789
780
 
790
- /**
791
- * Callback that is called on new text input with the argument
792
- * `{ nativeEvent: { text, previousText, range: { start, end } } }`.
793
- *
794
- * This prop requires multiline={true} to be set.
795
- */
796
- onTextInput?:
797
- | ((e: NativeSyntheticEvent<TextInputTextInputEventData>) => void)
798
- | undefined;
799
-
800
781
  /**
801
782
  * Invoked on content scroll with
802
783
  * `{ nativeEvent: { contentOffset: { x, y } } }`.
@@ -741,33 +741,12 @@ export type Props = $ReadOnly<{|
741
741
  */
742
742
  onChange?: ?(e: ChangeEvent) => mixed,
743
743
 
744
- /**
745
- * DANGER: this API is not stable and will change in the future.
746
- *
747
- * Callback will be called on the main thread and may result in dropped frames.
748
- * Callback that is called when the text input's text changes.
749
- *
750
- * @platform ios
751
- */
752
- unstable_onChangeSync?: ?(e: ChangeEvent) => mixed,
753
-
754
744
  /**
755
745
  * Callback that is called when the text input's text changes.
756
746
  * Changed text is passed as an argument to the callback handler.
757
747
  */
758
748
  onChangeText?: ?(text: string) => mixed,
759
749
 
760
- /**
761
- * DANGER: this API is not stable and will change in the future.
762
- *
763
- * Callback will be called on the main thread and may result in dropped frames.
764
- * Callback that is called when the text input's text changes.
765
- * Changed text is passed as an argument to the callback handler.
766
- *
767
- * @platform ios
768
- */
769
- unstable_onChangeTextSync?: ?(text: string) => mixed,
770
-
771
750
  /**
772
751
  * Callback that is called when the text input's content size changes.
773
752
  * This will be called with
@@ -796,21 +775,6 @@ export type Props = $ReadOnly<{|
796
775
  */
797
776
  onKeyPress?: ?(e: KeyPressEvent) => mixed,
798
777
 
799
- /**
800
- * DANGER: this API is not stable and will change in the future.
801
- *
802
- * Callback will be called on the main thread and may result in dropped frames.
803
- *
804
- * Callback that is called when a key is pressed.
805
- * This will be called with `{ nativeEvent: { key: keyValue } }`
806
- * where `keyValue` is `'Enter'` or `'Backspace'` for respective keys and
807
- * the typed-in character otherwise including `' '` for space.
808
- * Fires before `onChange` callbacks.
809
- *
810
- * @platform ios
811
- */
812
- unstable_onKeyPressSync?: ?(e: KeyPressEvent) => mixed,
813
-
814
778
  /**
815
779
  * Called when a single tap gesture is detected.
816
780
  */
@@ -1160,8 +1124,8 @@ function InternalTextInput(props: Props): React.Node {
1160
1124
  typeof props.value === 'string'
1161
1125
  ? props.value
1162
1126
  : typeof props.defaultValue === 'string'
1163
- ? props.defaultValue
1164
- : '';
1127
+ ? props.defaultValue
1128
+ : '';
1165
1129
 
1166
1130
  // This is necessary in case native updates the text and JS decides
1167
1131
  // that the update should be ignored and we should stick with the value
@@ -1310,26 +1274,6 @@ function InternalTextInput(props: Props): React.Node {
1310
1274
  setMostRecentEventCount(event.nativeEvent.eventCount);
1311
1275
  };
1312
1276
 
1313
- const _onChangeSync = (event: ChangeEvent) => {
1314
- const currentText = event.nativeEvent.text;
1315
- props.unstable_onChangeSync && props.unstable_onChangeSync(event);
1316
- props.unstable_onChangeTextSync &&
1317
- props.unstable_onChangeTextSync(currentText);
1318
-
1319
- if (inputRef.current == null) {
1320
- // calling `props.onChange` or `props.onChangeText`
1321
- // may clean up the input itself. Exits here.
1322
- return;
1323
- }
1324
-
1325
- setLastNativeText(currentText);
1326
- // This must happen last, after we call setLastNativeText.
1327
- // Different ordering can cause bugs when editing AndroidTextInputs
1328
- // with multiple Fragments.
1329
- // We must update this so that controlled input updates work.
1330
- setMostRecentEventCount(event.nativeEvent.eventCount);
1331
- };
1332
-
1333
1277
  const _onSelectionChange = (event: SelectionChangeEvent) => {
1334
1278
  props.onSelectionChange && props.onSelectionChange(event);
1335
1279
 
@@ -1459,6 +1403,12 @@ function InternalTextInput(props: Props): React.Node {
1459
1403
 
1460
1404
  const style = flattenStyle<TextStyleProp>(props.style);
1461
1405
 
1406
+ if (typeof style?.fontWeight === 'number') {
1407
+ // $FlowFixMe[prop-missing]
1408
+ // $FlowFixMe[cannot-write]
1409
+ style.fontWeight = style?.fontWeight.toString();
1410
+ }
1411
+
1462
1412
  if (Platform.OS === 'ios') {
1463
1413
  const RCTTextInputView =
1464
1414
  props.multiline === true
@@ -1472,10 +1422,6 @@ function InternalTextInput(props: Props): React.Node {
1472
1422
  style.paddingVertical == null &&
1473
1423
  style.paddingTop == null));
1474
1424
 
1475
- const useOnChangeSync =
1476
- (props.unstable_onChangeSync || props.unstable_onChangeTextSync) &&
1477
- !(props.onChange || props.onChangeText);
1478
-
1479
1425
  textInput = (
1480
1426
  <RCTTextInputView
1481
1427
  // $FlowFixMe[incompatible-type] - Figure out imperative + forward refs.
@@ -1491,9 +1437,7 @@ function InternalTextInput(props: Props): React.Node {
1491
1437
  mostRecentEventCount={mostRecentEventCount}
1492
1438
  nativeID={id ?? props.nativeID}
1493
1439
  onBlur={_onBlur}
1494
- onKeyPressSync={props.unstable_onKeyPressSync}
1495
1440
  onChange={_onChange}
1496
- onChangeSync={useOnChangeSync === true ? _onChangeSync : null}
1497
1441
  onContentSizeChange={props.onContentSizeChange}
1498
1442
  onFocus={_onFocus}
1499
1443
  onScroll={_onScroll}
@@ -1739,12 +1683,12 @@ const ExportedForwardRef: React.AbstractComponent<
1739
1683
  textContentType != null
1740
1684
  ? textContentType
1741
1685
  : Platform.OS === 'ios' &&
1742
- autoComplete &&
1743
- autoComplete in autoCompleteWebToTextContentTypeMap
1744
- ? // $FlowFixMe[invalid-computed-prop]
1745
- // $FlowFixMe[prop-missing]
1746
- autoCompleteWebToTextContentTypeMap[autoComplete]
1747
- : textContentType
1686
+ autoComplete &&
1687
+ autoComplete in autoCompleteWebToTextContentTypeMap
1688
+ ? // $FlowFixMe[invalid-computed-prop]
1689
+ // $FlowFixMe[prop-missing]
1690
+ autoCompleteWebToTextContentTypeMap[autoComplete]
1691
+ : textContentType
1748
1692
  }
1749
1693
  {...restProps}
1750
1694
  forwardedRef={forwardedRef}