@office-iss/react-native-win32 0.76.2 → 0.77.0-preview.2

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 (249) hide show
  1. package/.eslintignore +1 -1
  2. package/.flowconfig +5 -1
  3. package/CHANGELOG.json +179 -53
  4. package/CHANGELOG.md +82 -28
  5. package/Libraries/ActionSheetIOS/ActionSheetIOS.d.ts +1 -0
  6. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +13 -0
  7. package/Libraries/Animated/AnimatedEvent.js +1 -1
  8. package/Libraries/Animated/AnimatedImplementation.js +2 -2
  9. package/Libraries/Animated/NativeAnimatedAllowlist.js +20 -9
  10. package/Libraries/Animated/animations/Animation.js +60 -25
  11. package/Libraries/Animated/animations/DecayAnimation.js +26 -38
  12. package/Libraries/Animated/animations/SpringAnimation.js +33 -39
  13. package/Libraries/Animated/animations/TimingAnimation.js +34 -42
  14. package/Libraries/Animated/components/AnimatedFlatList.js +1 -1
  15. package/Libraries/Animated/components/AnimatedSectionList.js +3 -1
  16. package/Libraries/Animated/createAnimatedComponent.js +60 -33
  17. package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
  18. package/Libraries/Animated/nodes/AnimatedInterpolation.js +1 -1
  19. package/Libraries/Animated/nodes/AnimatedNode.js +39 -45
  20. package/Libraries/Animated/nodes/AnimatedObject.js +13 -3
  21. package/Libraries/Animated/nodes/AnimatedProps.js +104 -46
  22. package/Libraries/Animated/nodes/AnimatedStyle.js +116 -39
  23. package/Libraries/Animated/nodes/AnimatedTransform.js +56 -23
  24. package/Libraries/Animated/nodes/AnimatedValue.js +1 -1
  25. package/Libraries/Animated/nodes/AnimatedWithChildren.js +1 -3
  26. package/Libraries/Animated/useAnimatedProps.js +41 -35
  27. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +19 -3
  28. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +77 -5
  29. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +82 -5
  30. package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +4 -4
  31. package/Libraries/Components/Button.js +9 -4
  32. package/Libraries/Components/Button.win32.js +12 -4
  33. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +3 -1
  34. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +7 -0
  35. package/Libraries/Components/Pressable/Pressable.js +4 -4
  36. package/Libraries/Components/Pressable/Pressable.win32.js +4 -4
  37. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +13 -7
  38. package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +3 -2
  39. package/Libraries/Components/SafeAreaView/SafeAreaView.js +4 -4
  40. package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +4 -4
  41. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +0 -1
  42. package/Libraries/Components/ScrollView/ScrollView.js +49 -88
  43. package/Libraries/Components/ScrollView/ScrollViewCommands.js +1 -1
  44. package/Libraries/Components/ScrollView/ScrollViewContext.js +2 -0
  45. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +0 -2
  46. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +8 -9
  47. package/Libraries/Components/Switch/Switch.js +8 -6
  48. package/Libraries/Components/TextInput/InputAccessoryView.js +1 -1
  49. package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +4 -4
  50. package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +6 -4
  51. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +2 -1
  52. package/Libraries/Components/TextInput/TextInput.d.ts +27 -4
  53. package/Libraries/Components/TextInput/TextInput.flow.js +36 -19
  54. package/Libraries/Components/TextInput/TextInput.js +37 -13
  55. package/Libraries/Components/TextInput/TextInput.win32.js +40 -15
  56. package/Libraries/Components/TextInput/TextInputState.js +11 -13
  57. package/Libraries/Components/TextInput/TextInputState.win32.js +13 -16
  58. package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +3 -0
  59. package/Libraries/Components/Touchable/BoundingDimensions.js +11 -3
  60. package/Libraries/Components/Touchable/Position.js +7 -2
  61. package/Libraries/Components/Touchable/Touchable.js +4 -0
  62. package/Libraries/Components/Touchable/Touchable.win32.js +4 -0
  63. package/Libraries/Components/Touchable/TouchableBounce.js +6 -2
  64. package/Libraries/Components/Touchable/TouchableHighlight.js +5 -5
  65. package/Libraries/Components/Touchable/TouchableOpacity.js +6 -5
  66. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +1 -2
  67. package/Libraries/Components/View/ReactNativeStyleAttributes.js +6 -1
  68. package/Libraries/Components/View/View.js +4 -4
  69. package/Libraries/Components/View/View.win32.js +4 -4
  70. package/Libraries/Components/View/ViewNativeComponent.js +6 -98
  71. package/Libraries/Components/View/ViewPropTypes.d.ts +7 -0
  72. package/Libraries/Components/View/ViewPropTypes.js +0 -3
  73. package/Libraries/Components/View/ViewPropTypes.win32.js +0 -3
  74. package/Libraries/Components/View/ViewWin32.js +1 -0
  75. package/Libraries/Core/ExceptionsManager.js +50 -29
  76. package/Libraries/Core/ReactNativeVersion.js +3 -3
  77. package/Libraries/Core/__mocks__/NativeExceptionsManager.js +0 -1
  78. package/Libraries/Core/setUpBatchedBridge.js +1 -10
  79. package/Libraries/Core/setUpDeveloperTools.js +1 -5
  80. package/Libraries/Core/setUpErrorHandling.js +20 -18
  81. package/Libraries/Core/setUpReactDevTools.js +107 -8
  82. package/Libraries/Core/setUpSegmentFetcher.js +1 -0
  83. package/Libraries/Core/setUpTimers.js +21 -18
  84. package/Libraries/Debugging/DebuggingOverlay.js +4 -5
  85. package/Libraries/Image/AssetSourceResolver.js +12 -1
  86. package/Libraries/Image/Image.android.js +1 -5
  87. package/Libraries/Image/Image.d.ts +20 -29
  88. package/Libraries/Image/Image.ios.js +0 -2
  89. package/Libraries/Image/Image.win32.js +0 -2
  90. package/Libraries/Image/ImageBackground.js +2 -5
  91. package/Libraries/Image/ImageProps.js +7 -6
  92. package/Libraries/Image/ImageResizeMode.d.ts +8 -1
  93. package/Libraries/Image/ImageResizeMode.js +4 -1
  94. package/Libraries/Image/ImageSource.d.ts +0 -2
  95. package/Libraries/Image/ImageSource.js +0 -2
  96. package/Libraries/Image/ImageTypes.flow.js +11 -9
  97. package/Libraries/Image/ImageUtils.js +6 -3
  98. package/Libraries/Image/ImageViewNativeComponent.js +5 -3
  99. package/Libraries/Inspector/Inspector.js +1 -0
  100. package/Libraries/Inspector/Inspector.win32.js +2 -1
  101. package/Libraries/Inspector/NetworkOverlay.js +4 -0
  102. package/Libraries/Inspector/ReactDevToolsOverlay.js +8 -14
  103. package/Libraries/Inspector/getInspectorDataForViewAtPoint.js +3 -5
  104. package/Libraries/Interaction/InteractionManager.js +6 -1
  105. package/Libraries/Interaction/InteractionManagerStub.js +176 -0
  106. package/Libraries/Interaction/TouchHistoryMath.js +22 -19
  107. package/Libraries/JSInspector/NetworkAgent.js +1 -1
  108. package/Libraries/Lists/FlatList.d.ts +1 -2
  109. package/Libraries/Lists/FlatList.js +2 -2
  110. package/Libraries/Lists/SectionListModern.js +7 -7
  111. package/Libraries/Lists/__flowtests__/FlatList-flowtest.js +2 -2
  112. package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +1 -1
  113. package/Libraries/LogBox/Data/LogBoxData.js +3 -3
  114. package/Libraries/LogBox/LogBox.js +18 -5
  115. package/Libraries/LogBox/LogBoxInspectorContainer.js +1 -1
  116. package/Libraries/LogBox/LogBoxNotificationContainer.js +2 -2
  117. package/Libraries/LogBox/UI/AnsiHighlight.js +26 -17
  118. package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +6 -1
  119. package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.win32.js +6 -1
  120. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +1 -1
  121. package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +1 -1
  122. package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +1 -1
  123. package/Libraries/LogBox/UI/LogBoxMessage.js +2 -2
  124. package/Libraries/Modal/Modal.d.ts +12 -0
  125. package/Libraries/Modal/Modal.js +31 -4
  126. package/Libraries/NativeComponent/BaseViewConfig.android.js +72 -1
  127. package/Libraries/NativeComponent/BaseViewConfig.ios.js +2 -1
  128. package/Libraries/NativeComponent/BaseViewConfig.win32.js +3 -11
  129. package/Libraries/NativeComponent/NativeComponentRegistry.js +3 -3
  130. package/Libraries/NativeComponent/StaticViewConfigValidator.js +0 -1
  131. package/Libraries/Network/FormData.js +11 -3
  132. package/Libraries/Network/XHRInterceptor.js +63 -14
  133. package/Libraries/Network/XMLHttpRequest.js +26 -1
  134. package/Libraries/NewAppScreen/components/HermesBadge.js +1 -1
  135. package/Libraries/PermissionsAndroid/PermissionsAndroid.d.ts +49 -2
  136. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +4 -4
  137. package/Libraries/Pressability/HoverState.js +2 -0
  138. package/Libraries/Pressability/HoverState.win32.js +2 -0
  139. package/Libraries/Pressability/Pressability.js +2 -3
  140. package/Libraries/Pressability/Pressability.win32.js +2 -3
  141. package/Libraries/Pressability/usePressability.js +4 -1
  142. package/Libraries/ReactNative/AppContainer.js +1 -1
  143. package/Libraries/ReactNative/AppRegistry.js +1 -11
  144. package/Libraries/ReactNative/DisplayMode.js +1 -1
  145. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -3
  146. package/Libraries/ReactNative/RendererImplementation.js +18 -17
  147. package/Libraries/ReactNative/getCachedComponentWithDebugName.js +1 -3
  148. package/Libraries/ReactNative/renderApplication.js +9 -8
  149. package/Libraries/ReactNative/requireNativeComponent.js +5 -2
  150. package/Libraries/Renderer/shims/ReactFabric.js +3 -3
  151. package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -2
  152. package/Libraries/Renderer/shims/ReactNative.js +3 -3
  153. package/Libraries/Renderer/shims/ReactNativeTypes.js +22 -35
  154. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +5 -6
  155. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
  156. package/Libraries/StyleSheet/StyleSheet.js +7 -1
  157. package/Libraries/StyleSheet/StyleSheet.win32.js +7 -1
  158. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +13 -2
  159. package/Libraries/StyleSheet/StyleSheetTypes.js +24 -6
  160. package/Libraries/StyleSheet/processBackgroundImage.js +87 -110
  161. package/Libraries/StyleSheet/processTransform.js +3 -34
  162. package/Libraries/Text/Text.js +248 -249
  163. package/Libraries/Text/Text.win32.js +282 -295
  164. package/Libraries/Text/TextNativeComponent.js +0 -1
  165. package/Libraries/TurboModule/TurboModuleRegistry.js +5 -5
  166. package/Libraries/Types/CoreEventTypes.d.ts +3 -10
  167. package/Libraries/Types/CoreEventTypes.js +4 -6
  168. package/Libraries/Types/CoreEventTypes.win32.js +4 -6
  169. package/Libraries/Utilities/Appearance.js +3 -1
  170. package/Libraries/Utilities/BackHandler.android.js +6 -18
  171. package/Libraries/Utilities/BackHandler.d.ts +0 -4
  172. package/Libraries/Utilities/BackHandler.ios.js +0 -7
  173. package/Libraries/Utilities/BackHandler.win32.js +6 -18
  174. package/Libraries/Utilities/FocusManager.win32.js +1 -1
  175. package/Libraries/Utilities/HMRClient.js +3 -4
  176. package/Libraries/Utilities/Platform.flow.js +2 -2
  177. package/Libraries/Utilities/Platform.flow.win32.js +3 -2
  178. package/Libraries/Utilities/__mocks__/BackHandler.js +3 -8
  179. package/Libraries/Utilities/codegenNativeComponent.js +1 -1
  180. package/Libraries/Utilities/useMergeRefs.js +26 -7
  181. package/Libraries/WebSocket/WebSocketEvent.js +4 -1
  182. package/Libraries/WebSocket/WebSocketInterceptor.js +31 -13
  183. package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +6 -5
  184. package/Libraries/promiseRejectionTrackingOptions.js +1 -1
  185. package/index.js +10 -3
  186. package/index.win32.js +10 -3
  187. package/jest/setup.js +36 -1
  188. package/overrides.json +37 -37
  189. package/package.json +20 -20
  190. package/src/private/animated/NativeAnimatedHelper.js +18 -16
  191. package/src/private/animated/NativeAnimatedHelper.win32.js +18 -15
  192. package/src/private/animated/useAnimatedPropsMemo.js +356 -0
  193. package/src/private/components/HScrollViewNativeComponents.js +1 -27
  194. package/src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE.js +11 -8
  195. package/src/private/components/VScrollViewNativeComponents.js +2 -25
  196. package/src/private/debugging/ReactDevToolsSettingsManager.android.js +20 -0
  197. package/src/private/debugging/ReactDevToolsSettingsManager.ios.js +30 -0
  198. package/src/private/debugging/ReactDevToolsSettingsManager.win32.js +20 -0
  199. package/src/private/{fusebox → debugging}/setUpFuseboxReactDevToolsDispatcher.js +6 -0
  200. package/src/private/devmenu/DevMenu.d.ts +20 -0
  201. package/src/private/devmenu/DevMenu.js +31 -0
  202. package/src/private/featureflags/ReactNativeFeatureFlags.js +95 -86
  203. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +8 -2
  204. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +17 -19
  205. package/src/private/fusebox/specs/NativeReactDevToolsRuntimeSettingsModule.js +34 -0
  206. package/src/private/setup/setUpDOM.js +14 -6
  207. package/src/private/setup/setUpMutationObserver.js +5 -0
  208. package/src/private/specs/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -0
  209. package/src/private/specs/components/RCTModalHostViewNativeComponent.js +8 -0
  210. package/src/private/specs/modules/NativeAccessibilityInfo.js +9 -0
  211. package/src/private/specs/modules/NativeAccessibilityInfoWin32.js +9 -0
  212. package/src/private/specs/modules/NativeAccessibilityManager.js +4 -0
  213. package/src/private/specs/modules/NativeActionSheetManager.js +2 -0
  214. package/src/private/specs/modules/NativeAppearance.js +4 -10
  215. package/src/private/specs/modules/NativeExceptionsManager.js +0 -12
  216. package/src/private/specs/modules/{NativeDevToolsSettingsManager.js → NativeReactDevToolsSettingsManager.js} +3 -5
  217. package/src/private/webapis/dom/geometry/DOMRect.js +2 -2
  218. package/src/private/webapis/dom/geometry/DOMRectReadOnly.js +2 -2
  219. package/src/private/webapis/dom/nodes/ReactNativeElement.js +2 -3
  220. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +102 -11
  221. package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +26 -0
  222. package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -0
  223. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
  224. package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +9 -0
  225. package/src/private/webapis/performance/EventTiming.js +13 -8
  226. package/src/private/webapis/performance/Performance.js +66 -73
  227. package/src/private/webapis/performance/PerformanceEntry.js +2 -5
  228. package/src/private/webapis/performance/PerformanceObserver.js +65 -164
  229. package/src/private/webapis/performance/RawPerformanceEntry.js +1 -1
  230. package/src/private/webapis/performance/UserTiming.js +11 -7
  231. package/src/private/webapis/performance/Utilities.js +18 -0
  232. package/src/private/webapis/performance/specs/NativePerformance.js +71 -2
  233. package/src/private/webapis/performance/specs/__mocks__/NativePerformanceMock.js +267 -0
  234. package/src-win/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +19 -3
  235. package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +7 -0
  236. package/types/index.d.ts +1 -1
  237. package/types/public/ReactNativeTypes.d.ts +4 -8
  238. package/Libraries/DevToolsSettings/DevToolsSettingsManager.android.js +0 -35
  239. package/Libraries/DevToolsSettings/DevToolsSettingsManager.d.ts +0 -20
  240. package/Libraries/DevToolsSettings/DevToolsSettingsManager.ios.js +0 -49
  241. package/Libraries/DevToolsSettings/DevToolsSettingsManager.win32.js +0 -35
  242. package/Libraries/DevToolsSettings/NativeDevToolsSettingsManager.js +0 -13
  243. package/Libraries/ReactNative/ReactFabricInternals.js +0 -17
  244. package/src/private/components/useSyncOnScroll.js +0 -48
  245. package/src/private/webapis/performance/specs/NativePerformanceObserver.js +0 -61
  246. package/src/private/webapis/performance/specs/__mocks__/NativePerformance.js +0 -67
  247. package/src/private/webapis/performance/specs/__mocks__/NativePerformanceObserver.js +0 -127
  248. package/types/experimental.d.ts +0 -59
  249. /package/src/private/{fusebox → debugging}/FuseboxSessionObserver.js +0 -0
@@ -143,6 +143,7 @@ class NetworkOverlay extends React.Component<Props, State> {
143
143
  });
144
144
 
145
145
  XHRInterceptor.setRequestHeaderCallback((header, value, xhr) => {
146
+ // $FlowFixMe[prop-missing]
146
147
  const xhrIndex = this._getRequestIndexByXHRID(xhr._index);
147
148
  if (xhrIndex === -1) {
148
149
  return;
@@ -159,6 +160,7 @@ class NetworkOverlay extends React.Component<Props, State> {
159
160
  });
160
161
 
161
162
  XHRInterceptor.setSendCallback((data, xhr) => {
163
+ // $FlowFixMe[prop-missing]
162
164
  const xhrIndex = this._getRequestIndexByXHRID(xhr._index);
163
165
  if (xhrIndex === -1) {
164
166
  return;
@@ -173,6 +175,7 @@ class NetworkOverlay extends React.Component<Props, State> {
173
175
 
174
176
  XHRInterceptor.setHeaderReceivedCallback(
175
177
  (type, size, responseHeaders, xhr) => {
178
+ // $FlowFixMe[prop-missing]
176
179
  const xhrIndex = this._getRequestIndexByXHRID(xhr._index);
177
180
  if (xhrIndex === -1) {
178
181
  return;
@@ -190,6 +193,7 @@ class NetworkOverlay extends React.Component<Props, State> {
190
193
 
191
194
  XHRInterceptor.setResponseCallback(
192
195
  (status, timeout, response, responseURL, responseType, xhr) => {
196
+ // $FlowFixMe[prop-missing]
193
197
  const xhrIndex = this._getRequestIndexByXHRID(xhr._index);
194
198
  if (xhrIndex === -1) {
195
199
  return;
@@ -20,7 +20,6 @@ import StyleSheet from '../StyleSheet/StyleSheet';
20
20
  import ElementBox from './ElementBox';
21
21
  import * as React from 'react';
22
22
 
23
- const {findNodeHandle} = require('../ReactNative/RendererProxy');
24
23
  const getInspectorDataForViewAtPoint = require('./getInspectorDataForViewAtPoint');
25
24
 
26
25
  const {useEffect, useState, useCallback} = React;
@@ -78,20 +77,15 @@ export default function ReactDevToolsOverlay({
78
77
  x,
79
78
  y,
80
79
  viewData => {
81
- const {touchedViewTag, closestInstance, frame} = viewData;
82
- if (closestInstance != null || touchedViewTag != null) {
83
- // We call `selectNode` for both non-fabric(viewTag) and fabric(instance),
84
- // this makes sure it works for both architectures.
85
- reactDevToolsAgent.selectNode(findNodeHandle(touchedViewTag));
86
- if (closestInstance != null) {
87
- reactDevToolsAgent.selectNode(closestInstance);
88
- }
89
- setInspected({
90
- frame,
91
- });
92
- return true;
80
+ const {frame, closestPublicInstance} = viewData;
81
+
82
+ if (closestPublicInstance == null) {
83
+ return false;
93
84
  }
94
- return false;
85
+
86
+ reactDevToolsAgent.selectNode(closestPublicInstance);
87
+ setInspected({frame});
88
+ return true;
95
89
  },
96
90
  );
97
91
  },
@@ -9,18 +9,16 @@
9
9
  */
10
10
 
11
11
  import type {
12
- HostComponent,
12
+ HostInstance,
13
13
  TouchedViewDataAtPoint,
14
14
  } from '../Renderer/shims/ReactNativeTypes';
15
15
 
16
16
  const invariant = require('invariant');
17
- const React = require('react');
18
17
 
19
- export type HostRef = React.ElementRef<HostComponent<mixed>>;
20
18
  export type ReactRenderer = {
21
19
  rendererConfig: {
22
20
  getInspectorDataForViewAtPoint: (
23
- inspectedView: ?HostRef,
21
+ inspectedView: ?HostInstance,
24
22
  locationX: number,
25
23
  locationY: number,
26
24
  callback: Function,
@@ -52,7 +50,7 @@ function validateRenderers(): void {
52
50
  }
53
51
 
54
52
  module.exports = function getInspectorDataForViewAtPoint(
55
- inspectedView: ?HostRef,
53
+ inspectedView: ?HostInstance,
56
54
  locationX: number,
57
55
  locationY: number,
58
56
  callback: (viewData: TouchedViewDataAtPoint) => boolean,
@@ -10,6 +10,7 @@
10
10
 
11
11
  import type {Task} from './TaskQueue';
12
12
 
13
+ import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags';
13
14
  import EventEmitter from '../vendor/emitter/EventEmitter';
14
15
 
15
16
  const BatchedBridge = require('../BatchedBridge/BatchedBridge');
@@ -208,4 +209,8 @@ function _processUpdate() {
208
209
  _deleteInteractionSet.clear();
209
210
  }
210
211
 
211
- module.exports = InteractionManager;
212
+ module.exports = (
213
+ ReactNativeFeatureFlags.disableInteractionManager()
214
+ ? require('./InteractionManagerStub')
215
+ : InteractionManager
216
+ ) as typeof InteractionManager;
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ * @format
9
+ */
10
+
11
+ import type {EventSubscription} from '../vendor/emitter/EventEmitter';
12
+
13
+ const invariant = require('invariant');
14
+
15
+ export type Handle = number;
16
+
17
+ type Task =
18
+ | {
19
+ name: string,
20
+ run: () => void,
21
+ }
22
+ | {
23
+ name: string,
24
+ gen: () => Promise<void>,
25
+ }
26
+ | (() => void);
27
+
28
+ /**
29
+ * InteractionManager allows long-running work to be scheduled after any
30
+ * interactions/animations have completed. In particular, this allows JavaScript
31
+ * animations to run smoothly.
32
+ *
33
+ * Applications can schedule tasks to run after interactions with the following:
34
+ *
35
+ * ```
36
+ * InteractionManager.runAfterInteractions(() => {
37
+ * // ...long-running synchronous task...
38
+ * });
39
+ * ```
40
+ *
41
+ * Compare this to other scheduling alternatives:
42
+ *
43
+ * - requestAnimationFrame(): for code that animates a view over time.
44
+ * - setImmediate/setTimeout(): run code later, note this may delay animations.
45
+ * - runAfterInteractions(): run code later, without delaying active animations.
46
+ *
47
+ * The touch handling system considers one or more active touches to be an
48
+ * 'interaction' and will delay `runAfterInteractions()` callbacks until all
49
+ * touches have ended or been cancelled.
50
+ *
51
+ * InteractionManager also allows applications to register animations by
52
+ * creating an interaction 'handle' on animation start, and clearing it upon
53
+ * completion:
54
+ *
55
+ * ```
56
+ * var handle = InteractionManager.createInteractionHandle();
57
+ * // run animation... (`runAfterInteractions` tasks are queued)
58
+ * // later, on animation completion:
59
+ * InteractionManager.clearInteractionHandle(handle);
60
+ * // queued tasks run if all handles were cleared
61
+ * ```
62
+ *
63
+ * `runAfterInteractions` takes either a plain callback function, or a
64
+ * `PromiseTask` object with a `gen` method that returns a `Promise`. If a
65
+ * `PromiseTask` is supplied, then it is fully resolved (including asynchronous
66
+ * dependencies that also schedule more tasks via `runAfterInteractions`) before
67
+ * starting on the next task that might have been queued up synchronously
68
+ * earlier.
69
+ *
70
+ * By default, queued tasks are executed together in a loop in one
71
+ * `setImmediate` batch. If `setDeadline` is called with a positive number, then
72
+ * tasks will only be executed until the deadline (in terms of js event loop run
73
+ * time) approaches, at which point execution will yield via setTimeout,
74
+ * allowing events such as touches to start interactions and block queued tasks
75
+ * from executing, making apps more responsive.
76
+ *
77
+ * @deprecated
78
+ */
79
+ const InteractionManagerStub = {
80
+ Events: {
81
+ interactionStart: 'interactionStart',
82
+ interactionComplete: 'interactionComplete',
83
+ },
84
+
85
+ /**
86
+ * Schedule a function to run after all interactions have completed. Returns a cancellable
87
+ * "promise".
88
+ *
89
+ * @deprecated
90
+ */
91
+ runAfterInteractions(task: ?Task): {
92
+ then: <U>(
93
+ onFulfill?: ?(void) => ?(Promise<U> | U),
94
+ onReject?: ?(error: mixed) => ?(Promise<U> | U),
95
+ ) => Promise<U>,
96
+ cancel: () => void,
97
+ ...
98
+ } {
99
+ let immediateID: ?$FlowIssue;
100
+ const promise = new Promise((resolve, reject) => {
101
+ immediateID = setImmediate(() => {
102
+ if (typeof task === 'object' && task !== null) {
103
+ if (typeof task.gen === 'function') {
104
+ task.gen().then(resolve, reject);
105
+ } else if (typeof task.run === 'function') {
106
+ try {
107
+ task.run();
108
+ resolve();
109
+ } catch (error) {
110
+ reject(error);
111
+ }
112
+ } else {
113
+ reject(new TypeError(`Task "${task.name}" missing gen or run.`));
114
+ }
115
+ } else if (typeof task === 'function') {
116
+ try {
117
+ task();
118
+ resolve();
119
+ } catch (error) {
120
+ reject(error);
121
+ }
122
+ } else {
123
+ reject(new TypeError('Invalid task of type: ' + typeof task));
124
+ }
125
+ });
126
+ });
127
+
128
+ return {
129
+ // $FlowFixMe[method-unbinding] added when improving typing for this parameters
130
+ then: promise.then.bind(promise),
131
+ cancel() {
132
+ clearImmediate(immediateID);
133
+ },
134
+ };
135
+ },
136
+
137
+ /**
138
+ * Notify manager that an interaction has started.
139
+ *
140
+ * @deprecated
141
+ */
142
+ createInteractionHandle(): Handle {
143
+ return -1;
144
+ },
145
+
146
+ /**
147
+ * Notify manager that an interaction has completed.
148
+ *
149
+ * @deprecated
150
+ */
151
+ clearInteractionHandle(handle: Handle) {
152
+ invariant(!!handle, 'InteractionManager: Must provide a handle to clear.');
153
+ },
154
+
155
+ /**
156
+ * @deprecated
157
+ */
158
+ addListener(): EventSubscription {
159
+ return {
160
+ remove() {},
161
+ };
162
+ },
163
+
164
+ /**
165
+ * A positive number will use setTimeout to schedule any tasks after the
166
+ * eventLoopRunningTime hits the deadline value, otherwise all tasks will be
167
+ * executed in one setImmediate batch (default).
168
+ *
169
+ * @deprecated
170
+ */
171
+ setDeadline(deadline: number) {
172
+ // Do nothing.
173
+ },
174
+ };
175
+
176
+ module.exports = InteractionManagerStub;
@@ -5,8 +5,11 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  * @format
8
+ * @flow strict-local
8
9
  */
9
10
 
11
+ // $FlowFixMe[definition-cycle]
12
+ // $FlowFixMe[recursive-definition]
10
13
  const TouchHistoryMath = {
11
14
  /**
12
15
  * This code is optimized and not intended to look beautiful. This allows
@@ -25,11 +28,11 @@ const TouchHistoryMath = {
25
28
  * @return {number} value of centroid in specified dimension.
26
29
  */
27
30
  centroidDimension: function (
28
- touchHistory,
29
- touchesChangedAfter,
30
- isXAxis,
31
- ofCurrent,
32
- ) {
31
+ touchHistory: TouchHistoryMath,
32
+ touchesChangedAfter: number,
33
+ isXAxis: boolean,
34
+ ofCurrent: boolean,
35
+ ): number {
33
36
  const touchBank = touchHistory.touchBank;
34
37
  let total = 0;
35
38
  let count = 0;
@@ -82,9 +85,9 @@ const TouchHistoryMath = {
82
85
  },
83
86
 
84
87
  currentCentroidXOfTouchesChangedAfter: function (
85
- touchHistory,
86
- touchesChangedAfter,
87
- ) {
88
+ touchHistory: TouchHistoryMath,
89
+ touchesChangedAfter: number,
90
+ ): number {
88
91
  return TouchHistoryMath.centroidDimension(
89
92
  touchHistory,
90
93
  touchesChangedAfter,
@@ -94,9 +97,9 @@ const TouchHistoryMath = {
94
97
  },
95
98
 
96
99
  currentCentroidYOfTouchesChangedAfter: function (
97
- touchHistory,
98
- touchesChangedAfter,
99
- ) {
100
+ touchHistory: TouchHistoryMath,
101
+ touchesChangedAfter: number,
102
+ ): number {
100
103
  return TouchHistoryMath.centroidDimension(
101
104
  touchHistory,
102
105
  touchesChangedAfter,
@@ -106,9 +109,9 @@ const TouchHistoryMath = {
106
109
  },
107
110
 
108
111
  previousCentroidXOfTouchesChangedAfter: function (
109
- touchHistory,
110
- touchesChangedAfter,
111
- ) {
112
+ touchHistory: TouchHistoryMath,
113
+ touchesChangedAfter: number,
114
+ ): number {
112
115
  return TouchHistoryMath.centroidDimension(
113
116
  touchHistory,
114
117
  touchesChangedAfter,
@@ -118,9 +121,9 @@ const TouchHistoryMath = {
118
121
  },
119
122
 
120
123
  previousCentroidYOfTouchesChangedAfter: function (
121
- touchHistory,
122
- touchesChangedAfter,
123
- ) {
124
+ touchHistory: TouchHistoryMath,
125
+ touchesChangedAfter: number,
126
+ ): number {
124
127
  return TouchHistoryMath.centroidDimension(
125
128
  touchHistory,
126
129
  touchesChangedAfter,
@@ -129,7 +132,7 @@ const TouchHistoryMath = {
129
132
  );
130
133
  },
131
134
 
132
- currentCentroidX: function (touchHistory) {
135
+ currentCentroidX: function (touchHistory: TouchHistoryMath): number {
133
136
  return TouchHistoryMath.centroidDimension(
134
137
  touchHistory,
135
138
  0, // touchesChangedAfter
@@ -138,7 +141,7 @@ const TouchHistoryMath = {
138
141
  );
139
142
  },
140
143
 
141
- currentCentroidY: function (touchHistory) {
144
+ currentCentroidY: function (touchHistory: TouchHistoryMath): number {
142
145
  return TouchHistoryMath.centroidDimension(
143
146
  touchHistory,
144
147
  0, // touchesChangedAfter
@@ -260,7 +260,7 @@ type EnableArgs = {
260
260
  };
261
261
 
262
262
  class NetworkAgent extends InspectorAgent {
263
- static DOMAIN: $TEMPORARY$string<'Network'> = 'Network';
263
+ static DOMAIN: string = 'Network';
264
264
 
265
265
  _sendEvent: EventSender;
266
266
  _interceptor: ?Interceptor;
@@ -235,8 +235,7 @@ export abstract class FlatListComponent<
235
235
 
236
236
  getScrollableNode: () => any;
237
237
 
238
- // TODO: use `unknown` instead of `any` for Typescript >= 3.0
239
- setNativeProps: (props: {[key: string]: any}) => void;
238
+ setNativeProps: (props: {[key: string]: unknown}) => void;
240
239
  }
241
240
 
242
241
  export class FlatList<ItemT = any> extends FlatListComponent<
@@ -480,10 +480,10 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
480
480
  this._checkProps(this.props);
481
481
  }
482
482
 
483
- _listRef: ?React.ElementRef<typeof VirtualizedList>;
483
+ _listRef: ?VirtualizedList;
484
484
  _virtualizedListPairs: Array<ViewabilityConfigCallbackPair> = [];
485
485
 
486
- _captureRef = (ref: ?React.ElementRef<typeof VirtualizedList>) => {
486
+ _captureRef = (ref: ?VirtualizedList) => {
487
487
  this._listRef = ref;
488
488
  };
489
489
 
@@ -16,7 +16,7 @@ import type {
16
16
  SectionBase as _SectionBase,
17
17
  VirtualizedSectionListProps,
18
18
  } from '@react-native/virtualized-lists';
19
- import type {AbstractComponent, ElementRef} from 'react';
19
+ import type {ElementRef} from 'react';
20
20
 
21
21
  import Platform from '../Utilities/Platform';
22
22
  import {VirtualizedSectionList} from '@react-native/virtualized-lists';
@@ -93,7 +93,7 @@ type OptionalProps<SectionT: SectionBase<any>> = {|
93
93
  removeClippedSubviews?: boolean,
94
94
  |};
95
95
 
96
- export type Props<SectionT> = {|
96
+ export type Props<SectionT: SectionBase<any>> = $ReadOnly<{|
97
97
  ...$Diff<
98
98
  VirtualizedSectionListProps<SectionT>,
99
99
  {
@@ -115,7 +115,7 @@ export type Props<SectionT> = {|
115
115
  >,
116
116
  ...RequiredProps<SectionT>,
117
117
  ...OptionalProps<SectionT>,
118
- |};
118
+ |}>;
119
119
 
120
120
  /**
121
121
  * A performant interface for rendering sectioned lists, supporting the most handy features:
@@ -172,10 +172,10 @@ export type Props<SectionT> = {|
172
172
  * Alternatively, you can provide a custom `keyExtractor` prop.
173
173
  *
174
174
  */
175
- const SectionList: AbstractComponent<Props<SectionBase<any>>, any> = forwardRef<
176
- Props<SectionBase<any>>,
177
- any,
178
- >((props, ref) => {
175
+ const SectionList: component(
176
+ ref?: React.RefSetter<any>,
177
+ ...Props<SectionBase<any>>
178
+ ) = forwardRef<Props<SectionBase<any>>, any>((props, ref) => {
179
179
  const propsWithDefaults = {
180
180
  stickySectionHeadersEnabled: Platform.OS === 'ios',
181
181
  ...props,
@@ -75,7 +75,7 @@ module.exports = {
75
75
  );
76
76
  },
77
77
 
78
- testBadRenderItemFunction(): $TEMPORARY$array<React.Node> {
78
+ testBadRenderItemFunction(): $ReadOnlyArray<React.Node> {
79
79
  const data = [
80
80
  {
81
81
  title: 'foo',
@@ -105,7 +105,7 @@ module.exports = {
105
105
  ];
106
106
  },
107
107
 
108
- testOtherBadProps(): $TEMPORARY$array<React.Node> {
108
+ testOtherBadProps(): $ReadOnlyArray<React.Node> {
109
109
  return [
110
110
  // $FlowExpectedError - bad numColumns type "lots"
111
111
  <FlatList renderItem={renderMyListItem} data={[]} numColumns="lots" />,
@@ -44,7 +44,7 @@ module.exports = {
44
44
  return <SectionList renderItem={renderMyListItem} sections={sections} />;
45
45
  },
46
46
 
47
- testBadRenderItemFunction(): $TEMPORARY$array<React.Node> {
47
+ testBadRenderItemFunction(): $ReadOnlyArray<React.Node> {
48
48
  const sections = [
49
49
  {
50
50
  key: 'a',
@@ -18,7 +18,7 @@ import type {
18
18
  Message,
19
19
  } from './parseLogBoxLog';
20
20
 
21
- import DebuggerSessionObserver from '../../../src/private/fusebox/FuseboxSessionObserver';
21
+ import DebuggerSessionObserver from '../../../src/private/debugging/FuseboxSessionObserver';
22
22
  import parseErrorStack from '../../Core/Devtools/parseErrorStack';
23
23
  import NativeDevSettings from '../../NativeModules/specs/NativeDevSettings';
24
24
  import NativeLogBox from '../../NativeModules/specs/NativeLogBox';
@@ -421,7 +421,7 @@ type State = $ReadOnly<{|
421
421
  selectedLogIndex: number,
422
422
  |}>;
423
423
 
424
- type SubscribedComponent = React.AbstractComponent<
424
+ type SubscribedComponent = React.ComponentType<
425
425
  $ReadOnly<{|
426
426
  logs: $ReadOnlyArray<LogBoxLog>,
427
427
  isDisabled: boolean,
@@ -431,7 +431,7 @@ type SubscribedComponent = React.AbstractComponent<
431
431
 
432
432
  export function withSubscription(
433
433
  WrappedComponent: SubscribedComponent,
434
- ): React.AbstractComponent<{||}> {
434
+ ): React.ComponentType<{||}> {
435
435
  class LogBoxStateSubscription extends React.Component<Props, State> {
436
436
  static getDerivedStateFromError(): {hasError: boolean} {
437
437
  return {hasError: true};
@@ -52,6 +52,17 @@ if (__DEV__) {
52
52
 
53
53
  isLogBoxInstalled = true;
54
54
 
55
+ if (global.RN$registerExceptionListener != null) {
56
+ global.RN$registerExceptionListener(
57
+ (error: ExtendedExceptionData & {preventDefault: () => mixed}) => {
58
+ if (global.RN$isRuntimeReady?.() || !error.isFatal) {
59
+ error.preventDefault();
60
+ addException(error);
61
+ }
62
+ },
63
+ );
64
+ }
65
+
55
66
  // Trigger lazy initialization of module.
56
67
  require('../NativeModules/specs/NativeLogBox');
57
68
 
@@ -122,13 +133,15 @@ if (__DEV__) {
122
133
  }
123
134
  },
124
135
 
125
- addException(error: ExtendedExceptionData): void {
126
- if (isLogBoxInstalled) {
127
- LogBoxData.addException(error);
128
- }
129
- },
136
+ addException,
130
137
  };
131
138
 
139
+ function addException(error: ExtendedExceptionData): void {
140
+ if (isLogBoxInstalled) {
141
+ LogBoxData.addException(error);
142
+ }
143
+ }
144
+
132
145
  const isRCTLogAdviceWarning = (...args: Array<mixed>) => {
133
146
  // RCTLogAdvice is a native logging function designed to show users
134
147
  // a message in the console, but not show it to them in Logbox.
@@ -65,4 +65,4 @@ export class _LogBoxInspectorContainer extends React.Component<Props> {
65
65
 
66
66
  export default (LogBoxData.withSubscription(
67
67
  _LogBoxInspectorContainer,
68
- ): React.AbstractComponent<{||}>);
68
+ ): React.ComponentType<{||}>);
@@ -8,13 +8,13 @@
8
8
  * @format
9
9
  */
10
10
 
11
+ import SafeAreaView from '../../src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE';
11
12
  import View from '../Components/View/View';
12
13
  import StyleSheet from '../StyleSheet/StyleSheet';
13
14
  import * as LogBoxData from './Data/LogBoxData';
14
15
  import LogBoxLog from './Data/LogBoxLog';
15
16
  import LogBoxLogNotification from './UI/LogBoxNotification';
16
17
  import * as React from 'react';
17
- import SafeAreaView from '../../src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE';
18
18
 
19
19
  type Props = $ReadOnly<{|
20
20
  logs: $ReadOnlyArray<LogBoxLog>,
@@ -102,4 +102,4 @@ const styles = StyleSheet.create({
102
102
 
103
103
  export default (LogBoxData.withSubscription(
104
104
  _LogBoxNotificationContainer,
105
- ): React.AbstractComponent<{||}>);
105
+ ): React.ComponentType<{||}>);
@@ -37,6 +37,8 @@ const COLORS = {
37
37
  'ansi-bright-white': 'rgb(247, 247, 247)',
38
38
  };
39
39
 
40
+ const LRM = '\u200E'; // Left-to-Right Mark
41
+
40
42
  export default function Ansi({
41
43
  text,
42
44
  style,
@@ -80,25 +82,28 @@ export default function Ansi({
80
82
  };
81
83
 
82
84
  return (
83
- <View>
85
+ <View style={styles.container}>
84
86
  {parsedLines.map((items, i) => (
85
87
  <View style={styles.line} key={i}>
86
- {items.map((bundle, key) => {
87
- const textStyle =
88
- bundle.fg && COLORS[bundle.fg]
89
- ? {
90
- backgroundColor: bundle.bg && COLORS[bundle.bg],
91
- color: bundle.fg && COLORS[bundle.fg],
92
- }
93
- : {
94
- backgroundColor: bundle.bg && COLORS[bundle.bg],
95
- };
96
- return (
97
- <Text style={[style, textStyle]} key={key}>
98
- {getText(bundle.content, key)}
99
- </Text>
100
- );
101
- })}
88
+ <Text>
89
+ {LRM}
90
+ {items.map((bundle, key) => {
91
+ const textStyle =
92
+ bundle.fg && COLORS[bundle.fg]
93
+ ? {
94
+ backgroundColor: bundle.bg && COLORS[bundle.bg],
95
+ color: bundle.fg && COLORS[bundle.fg],
96
+ }
97
+ : {
98
+ backgroundColor: bundle.bg && COLORS[bundle.bg],
99
+ };
100
+ return (
101
+ <Text style={[style, textStyle]} key={key}>
102
+ {getText(bundle.content, key)}
103
+ </Text>
104
+ );
105
+ })}
106
+ </Text>
102
107
  </View>
103
108
  ))}
104
109
  </View>
@@ -106,6 +111,10 @@ export default function Ansi({
106
111
  }
107
112
 
108
113
  const styles = StyleSheet.create({
114
+ container: {
115
+ minWidth: '100%',
116
+ direction: 'ltr',
117
+ },
109
118
  line: {
110
119
  flexDirection: 'row',
111
120
  },
@@ -59,7 +59,9 @@ function LogBoxInspectorCodeFrame(props: Props): React.Node {
59
59
  <LogBoxInspectorSection heading="Source" action={<AppInfo />}>
60
60
  <View style={styles.box}>
61
61
  <View style={styles.frame}>
62
- <ScrollView horizontal>
62
+ <ScrollView
63
+ horizontal
64
+ contentContainerStyle={styles.contentContainer}>
63
65
  <AnsiHighlight style={styles.content} text={codeFrame.content} />
64
66
  </ScrollView>
65
67
  </View>
@@ -138,6 +140,9 @@ const styles = StyleSheet.create({
138
140
  paddingTop: 10,
139
141
  paddingBottom: 10,
140
142
  },
143
+ contentContainer: {
144
+ minWidth: '100%',
145
+ },
141
146
  content: {
142
147
  color: LogBoxStyle.getTextColor(1),
143
148
  fontSize: 12,