react-native-windows 0.74.12 → 0.75.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 (335) hide show
  1. package/.flowconfig +8 -2
  2. package/Common/Utilities.cpp +2 -2
  3. package/Folly/TEMP_UntilFollyUpdate/ConstexprMath.h +970 -0
  4. package/Folly/TEMP_UntilFollyUpdate/json.cpp +1110 -0
  5. package/Folly/TEMP_UntilFollyUpdate/lang/ToAscii.cpp +4 -2
  6. package/Libraries/Animated/AnimatedImplementation.js +2 -0
  7. package/Libraries/Animated/NativeAnimatedHelper.js +4 -0
  8. package/Libraries/Animated/createAnimatedComponent.js +10 -4
  9. package/Libraries/Animated/useAnimatedProps.js +56 -28
  10. package/Libraries/BatchedBridge/MessageQueue.js +1 -0
  11. package/Libraries/Components/Button.js +10 -5
  12. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +11 -2
  13. package/Libraries/Components/Flyout/Flyout.js +10 -10
  14. package/Libraries/Components/Flyout/FlyoutNativeComponent.js +8 -7
  15. package/Libraries/Components/Pressable/Pressable.js +13 -6
  16. package/Libraries/Components/Pressable/Pressable.windows.js +13 -6
  17. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +4 -0
  18. package/Libraries/Components/ScrollView/ScrollView.js +109 -29
  19. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +6 -0
  20. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.windows.js +6 -0
  21. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +13 -1
  22. package/Libraries/Components/StatusBar/StatusBar.js +1 -21
  23. package/Libraries/Components/Switch/Switch.windows.js +2 -0
  24. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +0 -15
  25. package/Libraries/Components/TextInput/InputAccessoryView.js +10 -1
  26. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +0 -12
  27. package/Libraries/Components/TextInput/TextInput.d.ts +0 -19
  28. package/Libraries/Components/TextInput/TextInput.js +14 -70
  29. package/Libraries/Components/TextInput/TextInput.windows.js +15 -72
  30. package/Libraries/Components/TextInput/WindowsTextInputNativeComponent.js +27 -12
  31. package/Libraries/Components/Touchable/Touchable.js +2 -2
  32. package/Libraries/Components/Touchable/TouchableHighlight.d.ts +4 -10
  33. package/Libraries/Components/Touchable/TouchableHighlight.js +3 -1
  34. package/Libraries/Components/Touchable/TouchableHighlight.windows.js +3 -1
  35. package/Libraries/Components/Touchable/TouchableOpacity.d.ts +4 -32
  36. package/Libraries/Components/Touchable/TouchableOpacity.js +3 -1
  37. package/Libraries/Components/Touchable/TouchableOpacity.windows.js +3 -1
  38. package/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts +8 -0
  39. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +117 -111
  40. package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +129 -110
  41. package/Libraries/Components/View/ReactNativeStyleAttributes.js +6 -0
  42. package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
  43. package/Libraries/Components/View/ReactNativeViewAttributes.windows.js +1 -0
  44. package/Libraries/Components/View/View.js +0 -11
  45. package/Libraries/Components/View/View.windows.js +0 -11
  46. package/Libraries/Components/View/ViewAccessibility.js +4 -4
  47. package/Libraries/Components/View/ViewAccessibility.windows.js +4 -4
  48. package/Libraries/Components/View/ViewPropTypes.d.ts +21 -59
  49. package/Libraries/Components/View/ViewPropTypes.js +7 -0
  50. package/Libraries/Components/View/ViewPropTypes.windows.js +7 -0
  51. package/Libraries/Core/Devtools/loadBundleFromServer.js +3 -3
  52. package/Libraries/Core/Devtools/loadBundleFromServer.windows.js +153 -0
  53. package/Libraries/Core/Devtools/parseErrorStack.js +5 -5
  54. package/Libraries/Core/Devtools/parseHermesStack.js +22 -16
  55. package/Libraries/Core/ErrorHandlers.js +116 -0
  56. package/Libraries/Core/ExceptionsManager.js +2 -2
  57. package/Libraries/Core/ReactNativeVersion.js +3 -3
  58. package/Libraries/Core/setUpDeveloperTools.js +3 -1
  59. package/Libraries/Core/setUpPerformance.js +6 -4
  60. package/Libraries/Core/setUpReactDevTools.js +70 -10
  61. package/Libraries/Core/setUpTimers.js +50 -31
  62. package/Libraries/Debugging/DebuggingOverlayRegistry.js +1 -1
  63. package/Libraries/Image/Image.android.js +23 -13
  64. package/Libraries/Image/Image.d.ts +14 -15
  65. package/Libraries/Image/Image.ios.js +21 -11
  66. package/Libraries/Image/Image.windows.js +21 -11
  67. package/Libraries/Image/ImageProps.js +16 -5
  68. package/Libraries/Image/ImageTypes.flow.js +7 -2
  69. package/Libraries/Image/ImageUtils.js +1 -0
  70. package/Libraries/Image/ImageViewNativeComponent.js +2 -1
  71. package/Libraries/Inspector/ElementBox.js +6 -3
  72. package/Libraries/Inspector/ElementProperties.js +1 -1
  73. package/Libraries/Interaction/TouchHistoryMath.js +4 -4
  74. package/Libraries/IntersectionObserver/IntersectionObserverManager.js +6 -26
  75. package/Libraries/JSInspector/NetworkAgent.js +1 -1
  76. package/Libraries/LogBox/Data/LogBoxData.js +39 -29
  77. package/Libraries/LogBox/Data/LogBoxLog.js +114 -2
  78. package/Libraries/LogBox/Data/parseLogBoxLog.js +168 -53
  79. package/Libraries/LogBox/LogBox.js +29 -12
  80. package/Libraries/LogBox/LogBoxNotificationContainer.js +4 -0
  81. package/Libraries/LogBox/UI/LogBoxInspector.js +8 -70
  82. package/Libraries/LogBox/UI/LogBoxInspectorBody.js +87 -0
  83. package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +6 -42
  84. package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +58 -0
  85. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +5 -66
  86. package/Libraries/LogBox/UI/LogBoxInspectorHeader.windows.js +5 -66
  87. package/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +76 -0
  88. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +8 -5
  89. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.windows.js +8 -5
  90. package/Libraries/LogBox/UI/LogBoxNotification.js +13 -152
  91. package/Libraries/LogBox/UI/LogBoxNotificationCountBadge.js +63 -0
  92. package/Libraries/LogBox/UI/LogBoxNotificationDismissButton.js +67 -0
  93. package/Libraries/LogBox/UI/LogBoxNotificationMessage.js +57 -0
  94. package/Libraries/NativeComponent/BaseViewConfig.android.js +5 -0
  95. package/Libraries/NativeComponent/BaseViewConfig.ios.js +5 -0
  96. package/Libraries/NativeComponent/BaseViewConfig.windows.js +5 -0
  97. package/Libraries/NativeComponent/NativeComponentRegistry.js +12 -5
  98. package/Libraries/NativeComponent/StaticViewConfigValidator.js +3 -0
  99. package/Libraries/Network/XMLHttpRequest.js +5 -1
  100. package/Libraries/NewAppScreen/components/LearnMoreLinks.js +3 -3
  101. package/Libraries/Pressability/Pressability.js +3 -51
  102. package/Libraries/Pressability/Pressability.windows.js +3 -51
  103. package/Libraries/ReactNative/AppRegistry.d.ts +4 -0
  104. package/Libraries/ReactNative/AppRegistry.js +2 -4
  105. package/Libraries/ReactNative/BridgelessUIManager.js +1 -21
  106. package/Libraries/ReactNative/FabricUIManager.js +0 -51
  107. package/Libraries/ReactNative/ReactFabricPublicInstance/warnForStyleProps.js +1 -0
  108. package/Libraries/ReactNative/RendererImplementation.js +20 -2
  109. package/Libraries/ReactNative/UIManager.d.ts +0 -21
  110. package/Libraries/ReactNative/UIManagerProperties.js +0 -3
  111. package/Libraries/ReactNative/__mocks__/FabricUIManager.js +5 -341
  112. package/Libraries/ReactNative/getNativeComponentAttributes.js +8 -8
  113. package/Libraries/Renderer/implementations/ReactFabric-dev.js +15682 -27088
  114. package/Libraries/Renderer/implementations/ReactFabric-prod.js +5082 -4381
  115. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3480 -2571
  116. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +15943 -27543
  117. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +5303 -4606
  118. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +3450 -2572
  119. package/Libraries/Renderer/shims/ReactFabric.js +2 -2
  120. package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -2
  121. package/Libraries/Renderer/shims/ReactNative.js +2 -3
  122. package/Libraries/Renderer/shims/ReactNativeTypes.js +24 -3
  123. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +2 -2
  124. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
  125. package/Libraries/Share/Share.d.ts +16 -10
  126. package/Libraries/Share/Share.js +14 -15
  127. package/Libraries/StyleSheet/StyleSheet.d.ts +1 -1
  128. package/Libraries/StyleSheet/StyleSheet.js +3 -10
  129. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +21 -21
  130. package/Libraries/StyleSheet/StyleSheetTypes.js +24 -18
  131. package/Libraries/StyleSheet/flattenStyle.js +1 -0
  132. package/Libraries/StyleSheet/processFilter.js +132 -0
  133. package/Libraries/StyleSheet/processTransform.js +18 -3
  134. package/Libraries/Text/Text.js +151 -128
  135. package/Libraries/Text/Text.windows.js +144 -128
  136. package/Libraries/Text/TextNativeComponent.js +5 -4
  137. package/Libraries/Text/TextProps.js +6 -6
  138. package/Libraries/Text/TextProps.windows.js +6 -6
  139. package/Libraries/TurboModule/TurboModuleRegistry.js +2 -1
  140. package/Libraries/Types/CodegenTypes.js +3 -0
  141. package/Libraries/Utilities/{LoadingView.android.js → DevLoadingView.js} +33 -11
  142. package/Libraries/Utilities/Dimensions.js +1 -0
  143. package/Libraries/Utilities/HMRClient.js +36 -8
  144. package/Libraries/Utilities/HMRClientProdShim.js +1 -0
  145. package/Libraries/Utilities/NativePlatformConstantsWin.js +2 -2
  146. package/Libraries/Utilities/Platform.android.js +4 -4
  147. package/Libraries/Utilities/RCTLog.js +1 -0
  148. package/Libraries/Utilities/ReactNativeTestTools.js +12 -24
  149. package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +11 -6
  150. package/Libraries/__tests__/ViewWindows-test.js +6 -6
  151. package/Libraries/promiseRejectionTrackingOptions.js +1 -0
  152. package/Microsoft.ReactNative/Base/FollyIncludes.h +1 -1
  153. package/Microsoft.ReactNative/ComponentView.idl +0 -17
  154. package/Microsoft.ReactNative/Composition.Input.idl +3 -3
  155. package/Microsoft.ReactNative/CompositionSwitcher.idl +0 -1
  156. package/Microsoft.ReactNative/Fabric/AbiState.cpp +3 -45
  157. package/Microsoft.ReactNative/Fabric/AbiState.h +0 -6
  158. package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +0 -3
  159. package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.cpp +2 -2
  160. package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.h +4 -4
  161. package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +0 -10
  162. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +27 -16
  163. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +1 -1
  164. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +48 -85
  165. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +0 -4
  166. package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +24 -24
  167. package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.h +6 -8
  168. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +0 -10
  169. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +0 -3
  170. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +29 -45
  171. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +1 -3
  172. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +6 -43
  173. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +23 -34
  174. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +1 -2
  175. package/Microsoft.ReactNative/Fabric/Composition/UriImageManager.cpp +9 -3
  176. package/Microsoft.ReactNative/Fabric/Composition/UriImageManager.h +1 -1
  177. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +17 -48
  178. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +3 -7
  179. package/Microsoft.ReactNative/Fabric/WindowsImageManager.cpp +23 -16
  180. package/Microsoft.ReactNative/Fabric/WindowsImageManager.h +5 -2
  181. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewEventEmitter.cpp +2 -10
  182. package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.cpp +107 -36
  183. package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.h +18 -12
  184. package/Microsoft.ReactNative/Modules/DevSettingsModule.cpp +4 -0
  185. package/Microsoft.ReactNative/Modules/DevSettingsModule.h +1 -0
  186. package/Microsoft.ReactNative/Modules/ImageViewManagerModule.cpp +1 -2
  187. package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +7 -4
  188. package/Microsoft.ReactNative/Modules/NativeUIManager.h +1 -1
  189. package/Microsoft.ReactNative/Modules/PlatformConstantsWinModule.cpp +2 -2
  190. package/Microsoft.ReactNative/Modules/PlatformConstantsWinModule.h +3 -3
  191. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +13 -20
  192. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -1
  193. package/Microsoft.ReactNative/Timer.idl +1 -3
  194. package/Microsoft.ReactNative/Utils/BatchingEventEmitter.cpp +1 -1
  195. package/Microsoft.ReactNative/Utils/LocalBundleReader.cpp +2 -3
  196. package/Microsoft.ReactNative/Utils/ValueUtils.cpp +1 -1
  197. package/Microsoft.ReactNative/Views/DynamicAutomationPeer.cpp +2 -2
  198. package/Microsoft.ReactNative/Views/TextInputViewManager.cpp +1 -1
  199. package/Microsoft.ReactNative/packages.lock.json +41 -78
  200. package/Microsoft.ReactNative.Cxx/JSI/LongLivedJsiValue.h +1 -1
  201. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +5 -0
  202. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems.filters +1 -0
  203. package/Microsoft.ReactNative.Cxx/TurboModuleProvider.cpp +14 -6
  204. package/Microsoft.ReactNative.Cxx/TurboModuleProvider.h +2 -2
  205. package/Microsoft.ReactNative.Managed/Microsoft.ReactNative.Managed.csproj +1 -1
  206. package/Microsoft.ReactNative.Managed/packages.lock.json +3 -3
  207. package/PropertySheets/External/Microsoft.ReactNative.WindowsSdk.Default.props +4 -4
  208. package/PropertySheets/Generated/PackageVersion.g.props +4 -4
  209. package/README.md +21 -21
  210. package/ReactCommon/ReactCommon.vcxproj +2 -0
  211. package/ReactCommon/ReactCommon.vcxproj.filters +3 -0
  212. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +67 -0
  213. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.h +180 -0
  214. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +351 -0
  215. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +6 -3
  216. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/Base.h +152 -0
  217. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/Bridging.h +2 -1
  218. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/CallbackWrapper.h +13 -15
  219. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/EventEmitter.h +137 -0
  220. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/Function.h +283 -0
  221. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModule.cpp +7 -10
  222. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModule.h +162 -0
  223. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModuleUtils.h +2 -4
  224. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/scrollview/ScrollViewProps.cpp +33 -8
  225. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/JSRuntimeFactory.cpp +45 -0
  226. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/JSRuntimeFactory.h +67 -0
  227. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +104 -74
  228. package/Scripts/Tfs/Layout-MSRN-Headers.ps1 +4 -0
  229. package/Scripts/rnw-dependencies.ps1 +36 -23
  230. package/Shared/HermesRuntimeHolder.cpp +19 -1
  231. package/Shared/HermesRuntimeHolder.h +8 -1
  232. package/Shared/HermesSamplingProfiler.cpp +1 -2
  233. package/Shared/Networking/WinRTWebSocketResource.cpp +3 -3
  234. package/Shared/OInstance.cpp +1 -2
  235. package/Shared/Shared.vcxitems +21 -15
  236. package/Shared/Shared.vcxitems.filters +8 -3
  237. package/Shared/Threading/BatchingQueueThread.cpp +6 -2
  238. package/Shared/Threading/BatchingQueueThread.h +2 -2
  239. package/Shared/Utils/CppWinrtLessExceptions.h +2 -2
  240. package/codegen/NativeAppStateSpec.g.h +8 -8
  241. package/codegen/NativeBlobModuleSpec.g.h +0 -10
  242. package/codegen/NativeDOMSpec.g.h +136 -0
  243. package/codegen/NativeDevSettingsSpec.g.h +11 -5
  244. package/codegen/NativeIdleCallbacksSpec.g.h +64 -0
  245. package/codegen/NativeIntersectionObserverSpec.g.h +14 -14
  246. package/codegen/NativeMicrotasksSpec.g.h +34 -0
  247. package/codegen/NativePerformanceSpec.g.h +35 -7
  248. package/codegen/NativePlatformConstantsWindowsSpec.g.h +81 -0
  249. package/codegen/NativePushNotificationManagerIOSSpec.g.h +15 -19
  250. package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +111 -39
  251. package/codegen/NativeUIManagerSpec.g.h +5 -17
  252. package/codegen/react/components/rnwcore/Props.cpp +1 -1
  253. package/codegen/react/components/rnwcore/Props.h +16 -12
  254. package/codegen/react/components/rnwcore/States.h +0 -26
  255. package/codegen/rnwcoreJSI-generated.cpp +688 -463
  256. package/codegen/rnwcoreJSI.h +1374 -2867
  257. package/fmt/TEMP_UntilFmtUpdate/core.h +2925 -0
  258. package/fmt/fmt.vcxproj +1 -1
  259. package/jest/mockComponent.js +7 -0
  260. package/jest/renderer.js +25 -14
  261. package/jest/setup.js +19 -13
  262. package/package.json +29 -27
  263. package/rn-get-polyfills.js +1 -0
  264. package/src/private/core/composeStyles.js +27 -0
  265. package/src/private/featureflags/ReactNativeFeatureFlags.js +93 -33
  266. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +23 -4
  267. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +56 -0
  268. package/src/private/fusebox/setUpFuseboxReactDevToolsDispatcher.js +108 -0
  269. package/src/private/specs/modules/NativeBlobModule.js +4 -2
  270. package/src/private/specs/modules/NativeDevSettings.js +1 -0
  271. package/src/private/specs/modules/NativePushNotificationManagerIOS.js +0 -4
  272. package/src/private/specs/modules/NativeUIManager.js +0 -7
  273. package/src/private/webapis/dom/geometry/DOMRectReadOnly.js +24 -24
  274. package/src/private/webapis/dom/nodes/ReactNativeElement.js +11 -14
  275. package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +2 -3
  276. package/src/private/webapis/dom/nodes/ReadOnlyElement.js +24 -54
  277. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +5 -13
  278. package/src/private/webapis/dom/nodes/specs/NativeDOM.js +468 -0
  279. package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +413 -0
  280. package/src/private/webapis/dom/oldstylecollections/DOMRectList.js +4 -4
  281. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +4 -4
  282. package/src/private/webapis/dom/oldstylecollections/NodeList.js +5 -5
  283. package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +34 -0
  284. package/src/private/webapis/microtasks/specs/NativeMicrotasks.js +21 -0
  285. package/src/private/webapis/performance/EventCounts.js +1 -1
  286. package/src/private/webapis/performance/MemoryInfo.js +9 -9
  287. package/src/private/webapis/performance/Performance.js +10 -56
  288. package/src/private/webapis/performance/PerformanceObserver.js +30 -22
  289. package/src/private/webapis/performance/RawPerformanceEntry.js +2 -7
  290. package/src/private/webapis/performance/ReactNativeStartupTiming.js +18 -18
  291. package/src/private/webapis/performance/UserTiming.js +63 -0
  292. package/src/private/webapis/performance/{NativePerformance.js → specs/NativePerformance.js} +3 -2
  293. package/src/private/webapis/performance/{NativePerformanceObserver.js → specs/NativePerformanceObserver.js} +2 -2
  294. package/src/private/webapis/performance/{__mocks__ → specs/__mocks__}/NativePerformance.js +1 -1
  295. package/src/private/webapis/performance/{__mocks__ → specs/__mocks__}/NativePerformanceObserver.js +3 -4
  296. package/stubs/glog/logging.h +1 -0
  297. package/template/cpp-lib/proj/MyLib.vcxproj +1 -1
  298. package/template/cs-lib/proj/MyLib.csproj +1 -1
  299. package/template/metro.config.js +13 -2
  300. package/templates/cpp-app/template.config.js +1 -1
  301. package/templates/cpp-lib/example/metro.config.js +2 -2
  302. package/templates/cpp-lib/template.config.js +1 -1
  303. package/templates/old/generateWrapper.js +4 -1
  304. package/types/modules/globals.d.ts +4 -0
  305. package/Libraries/Lists/FlatList.windows.js +0 -717
  306. package/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js +0 -13
  307. package/Libraries/Utilities/LoadingView.ios.js +0 -50
  308. package/Libraries/Utilities/LoadingView.js +0 -16
  309. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModuleBinding.cpp +0 -178
  310. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/utils/jsi-utils.cpp +0 -39
  311. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/utils/jsi-utils.h +0 -31
  312. package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/YGEnums.h +0 -137
  313. package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/algorithm/CalculateLayout.cpp +0 -2377
  314. package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/config/Config.cpp +0 -140
  315. package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/config/Config.h +0 -92
  316. package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/enums/ExperimentalFeature.h +0 -40
  317. package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/LayoutResults.cpp +0 -48
  318. package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/LayoutResults.h +0 -122
  319. package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/Node.cpp +0 -366
  320. package/codegen/NativeAnimationsDebugModuleSpec.g.h +0 -40
  321. package/codegen/NativePlatformConstantsWinSpec.g.h +0 -81
  322. package/jest/ReactNativeInternalFeatureFlagsMock.js +0 -13
  323. package/src/private/featureflags/NativeReactNativeFeatureFlags.js +0 -44
  324. package/src/private/featureflags/__tests__/ReactNativeFeatureFlags-test.js +0 -92
  325. package/src/private/specs/modules/NativeAnimationsDebugModule.js +0 -20
  326. package/src/private/webapis/dom/oldstylecollections/__tests__/DOMRectList-test.js +0 -85
  327. package/src/private/webapis/dom/oldstylecollections/__tests__/HTMLCollection-test.js +0 -80
  328. package/src/private/webapis/dom/oldstylecollections/__tests__/NodeList-test.js +0 -161
  329. package/src/private/webapis/performance/__tests__/EventCounts-test.js +0 -116
  330. package/src/private/webapis/performance/__tests__/NativePerformanceMock-test.js +0 -82
  331. package/src/private/webapis/performance/__tests__/NativePerformanceObserverMock-test.js +0 -108
  332. package/src/private/webapis/performance/__tests__/Performance-test.js +0 -117
  333. package/src/private/webapis/performance/__tests__/PerformanceObserver-test.js +0 -208
  334. package/template/metro.devMode.config.js +0 -56
  335. /package/src/private/specs/modules/{NativePlatformConstantsWin.js → NativePlatformConstantsWindows.js} +0 -0
@@ -13,6 +13,7 @@ import type {
13
13
  Category,
14
14
  CodeFrame,
15
15
  ComponentStack,
16
+ ComponentStackType,
16
17
  Message,
17
18
  } from './parseLogBoxLog';
18
19
 
@@ -22,23 +23,58 @@ type SymbolicationStatus = 'NONE' | 'PENDING' | 'COMPLETE' | 'FAILED';
22
23
 
23
24
  export type LogLevel = 'warn' | 'error' | 'fatal' | 'syntax';
24
25
 
25
- export type LogBoxLogData = $ReadOnly<{|
26
+ // TODO: once component stacks are fully supported, we can refactor
27
+ // ComponentStack to just be Stack and remove these conversions fns.
28
+ function convertComponentStateToStack(componentStack: ComponentStack): Stack {
29
+ return componentStack.map(frame => ({
30
+ column: frame?.location?.column,
31
+ file: frame.fileName,
32
+ lineNumber: frame?.location?.row,
33
+ methodName: frame.content,
34
+ collapse: false,
35
+ }));
36
+ }
37
+
38
+ function convertStackToComponentStack(stack: Stack): ComponentStack {
39
+ const componentStack = [];
40
+ for (let i = 0; i < stack.length; i++) {
41
+ const frame = stack[i];
42
+ // NOTE: Skip stack frames missing location.
43
+ if (frame.lineNumber != null && frame.column != null) {
44
+ componentStack.push({
45
+ fileName: frame?.file || '',
46
+ location: {
47
+ row: frame.lineNumber,
48
+ column: frame.column,
49
+ },
50
+ content: frame.methodName,
51
+ collapse: false,
52
+ });
53
+ }
54
+ }
55
+ return componentStack;
56
+ }
57
+
58
+ export type LogBoxLogData = $ReadOnly<{
26
59
  level: LogLevel,
27
60
  type?: ?string,
28
61
  message: Message,
29
62
  stack: Stack,
30
63
  category: string,
64
+ componentStackType?: ComponentStackType,
31
65
  componentStack: ComponentStack,
32
66
  codeFrame?: ?CodeFrame,
33
67
  isComponentError: boolean,
34
68
  extraData?: mixed,
35
- |}>;
69
+ onNotificationPress?: ?() => void,
70
+ }>;
36
71
 
37
72
  class LogBoxLog {
38
73
  message: Message;
39
74
  type: ?string;
40
75
  category: Category;
41
76
  componentStack: ComponentStack;
77
+ componentStackType: ComponentStackType;
42
78
  stack: Stack;
43
79
  count: number;
44
80
  level: LogLevel;
@@ -54,6 +90,20 @@ class LogBoxLog {
54
90
  stack: null,
55
91
  status: 'NONE',
56
92
  };
93
+ symbolicatedComponentStack:
94
+ | $ReadOnly<{|error: null, componentStack: null, status: 'NONE'|}>
95
+ | $ReadOnly<{|error: null, componentStack: null, status: 'PENDING'|}>
96
+ | $ReadOnly<{|
97
+ error: null,
98
+ componentStack: ComponentStack,
99
+ status: 'COMPLETE',
100
+ |}>
101
+ | $ReadOnly<{|error: Error, componentStack: null, status: 'FAILED'|}> = {
102
+ error: null,
103
+ componentStack: null,
104
+ status: 'NONE',
105
+ };
106
+ onNotificationPress: ?() => void;
57
107
 
58
108
  constructor(data: LogBoxLogData) {
59
109
  this.level = data.level;
@@ -62,10 +112,12 @@ class LogBoxLog {
62
112
  this.stack = data.stack;
63
113
  this.category = data.category;
64
114
  this.componentStack = data.componentStack;
115
+ this.componentStackType = data.componentStackType || 'legacy';
65
116
  this.codeFrame = data.codeFrame;
66
117
  this.isComponentError = data.isComponentError;
67
118
  this.extraData = data.extraData;
68
119
  this.count = 1;
120
+ this.onNotificationPress = data.onNotificationPress;
69
121
  }
70
122
 
71
123
  incrementCount(): void {
@@ -78,6 +130,15 @@ class LogBoxLog {
78
130
  : this.stack;
79
131
  }
80
132
 
133
+ getAvailableComponentStack(): ComponentStack {
134
+ if (this.componentStackType === 'legacy') {
135
+ return this.componentStack;
136
+ }
137
+ return this.symbolicatedComponentStack.status === 'COMPLETE'
138
+ ? this.symbolicatedComponentStack.componentStack
139
+ : this.componentStack;
140
+ }
141
+
81
142
  retrySymbolicate(callback?: (status: SymbolicationStatus) => void): void {
82
143
  if (this.symbolicated.status !== 'COMPLETE') {
83
144
  LogBoxSymbolication.deleteStack(this.stack);
@@ -102,6 +163,25 @@ class LogBoxLog {
102
163
  this.updateStatus(error, null, null, callback);
103
164
  },
104
165
  );
166
+ if (this.componentStack != null && this.componentStackType === 'stack') {
167
+ this.updateComponentStackStatus(null, null, null, callback);
168
+ const componentStackFrames = convertComponentStateToStack(
169
+ this.componentStack,
170
+ );
171
+ LogBoxSymbolication.symbolicate(componentStackFrames, []).then(
172
+ data => {
173
+ this.updateComponentStackStatus(
174
+ null,
175
+ convertStackToComponentStack(data.stack),
176
+ null,
177
+ callback,
178
+ );
179
+ },
180
+ error => {
181
+ this.updateComponentStackStatus(error, null, null, callback);
182
+ },
183
+ );
184
+ }
105
185
  }
106
186
  }
107
187
 
@@ -140,6 +220,38 @@ class LogBoxLog {
140
220
  callback(this.symbolicated.status);
141
221
  }
142
222
  }
223
+
224
+ updateComponentStackStatus(
225
+ error: ?Error,
226
+ componentStack: ?ComponentStack,
227
+ codeFrame: ?CodeFrame,
228
+ callback?: (status: SymbolicationStatus) => void,
229
+ ): void {
230
+ const lastStatus = this.symbolicatedComponentStack.status;
231
+ if (error != null) {
232
+ this.symbolicatedComponentStack = {
233
+ error,
234
+ componentStack: null,
235
+ status: 'FAILED',
236
+ };
237
+ } else if (componentStack != null) {
238
+ this.symbolicatedComponentStack = {
239
+ error: null,
240
+ componentStack,
241
+ status: 'COMPLETE',
242
+ };
243
+ } else {
244
+ this.symbolicatedComponentStack = {
245
+ error: null,
246
+ componentStack: null,
247
+ status: 'PENDING',
248
+ };
249
+ }
250
+
251
+ if (callback && lastStatus !== this.symbolicatedComponentStack.status) {
252
+ callback(this.symbolicatedComponentStack.status);
253
+ }
254
+ }
143
255
  }
144
256
 
145
257
  export default LogBoxLog;
@@ -18,11 +18,62 @@ import ansiRegex from 'ansi-regex';
18
18
 
19
19
  const ANSI_REGEX = ansiRegex().source;
20
20
 
21
- const BABEL_TRANSFORM_ERROR_FORMAT =
21
+ const RE_TRANSFORM_ERROR = /^TransformError /;
22
+ const RE_COMPONENT_STACK_LINE = /\n {4}(in|at) /;
23
+ const RE_COMPONENT_STACK_LINE_GLOBAL = /\n {4}(in|at) /g;
24
+ const RE_COMPONENT_STACK_LINE_OLD = / {4}in/;
25
+ const RE_COMPONENT_STACK_LINE_NEW = / {4}at/;
26
+ const RE_COMPONENT_STACK_LINE_STACK_FRAME = /@.*\n/;
27
+
28
+ // "TransformError " (Optional) and either "SyntaxError: " or "ReferenceError: "
29
+ // Capturing groups:
30
+ // 1: error message
31
+ // 2: file path
32
+ // 3: line number
33
+ // 4: column number
34
+ // \n\n
35
+ // 5: code frame
36
+ const RE_BABEL_TRANSFORM_ERROR_FORMAT =
22
37
  /^(?:TransformError )?(?:SyntaxError: |ReferenceError: )(.*): (.*) \((\d+):(\d+)\)\n\n([\s\S]+)/;
23
38
 
39
+ // Capturing groups:
40
+ // 1: component name
41
+ // "at"
42
+ // 2: file path including extension
43
+ // 3: line number
44
+ const RE_COMPONENT_STACK_WITH_SOURCE =
45
+ /(.*) \(at (.*\.(?:js|jsx|ts|tsx)):([\d]+)\)/;
46
+
47
+ // Capturing groups:
48
+ // 1: component name
49
+ // "at"
50
+ // 2: parent component name
51
+ const RE_COMPONENT_STACK_NO_SOURCE = /(.*) \(created by .*\)/;
52
+
53
+ // Capturing groups:
54
+ // - non-capturing "TransformError " (optional)
55
+ // - non-capturing Error message
56
+ // 1: file path
57
+ // 2: file name
58
+ // 3: error message
59
+ // 4: code frame, which includes code snippet indicators or terminal escape sequences for formatting.
60
+ const RE_BABEL_CODE_FRAME_ERROR_FORMAT =
61
+ // eslint-disable-next-line no-control-regex
62
+ /^(?:TransformError )?(?:.*):? (?:.*?)(\/.*): ([\s\S]+?)\n([ >]{2}[\d\s]+ \|[\s\S]+|\u{001b}[\s\S]+)/u;
63
+
64
+ // Capturing groups:
65
+ // - non-capturing "InternalError Metro has encountered an error:"
66
+ // 1: error title
67
+ // 2: error message
68
+ // 3: file path
69
+ // 4: line number
70
+ // 5: column number
71
+ // 6: code frame, which includes code snippet indicators or terminal escape sequences for formatting.
72
+ const RE_METRO_ERROR_FORMAT =
73
+ /^(?:InternalError Metro has encountered an error:) (.*): (.*) \((\d+):(\d+)\)\n\n([\s\S]+)/u;
74
+
24
75
  // https://github.com/babel/babel/blob/33dbb85e9e9fe36915273080ecc42aee62ed0ade/packages/babel-code-frame/src/index.ts#L183-L184
25
- const BABEL_CODE_FRAME_MARKER_PATTERN = new RegExp(
76
+ const RE_BABEL_CODE_FRAME_MARKER_PATTERN = new RegExp(
26
77
  [
27
78
  // Beginning of a line (per 'm' flag)
28
79
  '^',
@@ -42,12 +93,14 @@ const BABEL_CODE_FRAME_MARKER_PATTERN = new RegExp(
42
93
  'm',
43
94
  );
44
95
 
45
- const BABEL_CODE_FRAME_ERROR_FORMAT =
46
- // eslint-disable-next-line no-control-regex
47
- /^(?:TransformError )?(?:.*):? (?:.*?)(\/.*): ([\s\S]+?)\n([ >]{2}[\d\s]+ \|[\s\S]+|\u{001b}[\s\S]+)/u;
48
-
49
- const METRO_ERROR_FORMAT =
50
- /^(?:InternalError Metro has encountered an error:) (.*): (.*) \((\d+):(\d+)\)\n\n([\s\S]+)/u;
96
+ export function hasComponentStack(args: $ReadOnlyArray<mixed>): boolean {
97
+ for (const arg of args) {
98
+ if (typeof arg === 'string' && isComponentStack(arg)) {
99
+ return true;
100
+ }
101
+ }
102
+ return false;
103
+ }
51
104
 
52
105
  export type ExtendedExceptionData = ExceptionData & {
53
106
  isComponentError: boolean,
@@ -79,6 +132,7 @@ export type Message = $ReadOnly<{|
79
132
  |}>;
80
133
 
81
134
  export type ComponentStack = $ReadOnlyArray<CodeFrame>;
135
+ export type ComponentStackType = 'legacy' | 'stack';
82
136
 
83
137
  const SUBSTITUTION = UTFSequence.BOM + '%s';
84
138
 
@@ -158,9 +212,12 @@ export function parseInterpolation(args: $ReadOnlyArray<mixed>): $ReadOnly<{|
158
212
  }
159
213
 
160
214
  function isComponentStack(consoleArgument: string) {
161
- const isOldComponentStackFormat = / {4}in/.test(consoleArgument);
162
- const isNewComponentStackFormat = / {4}at/.test(consoleArgument);
163
- const isNewJSCComponentStackFormat = /@.*\n/.test(consoleArgument);
215
+ const isOldComponentStackFormat =
216
+ RE_COMPONENT_STACK_LINE_OLD.test(consoleArgument);
217
+ const isNewComponentStackFormat =
218
+ RE_COMPONENT_STACK_LINE_NEW.test(consoleArgument);
219
+ const isNewJSCComponentStackFormat =
220
+ RE_COMPONENT_STACK_LINE_STACK_FRAME.test(consoleArgument);
164
221
 
165
222
  return (
166
223
  isOldComponentStackFormat ||
@@ -169,42 +226,62 @@ function isComponentStack(consoleArgument: string) {
169
226
  );
170
227
  }
171
228
 
172
- export function parseComponentStack(message: string): ComponentStack {
229
+ export function parseComponentStack(message: string): {
230
+ type: ComponentStackType,
231
+ stack: ComponentStack,
232
+ } {
173
233
  // In newer versions of React, the component stack is formatted as a call stack frame.
174
234
  // First try to parse the component stack as a call stack frame, and if that doesn't
175
235
  // work then we'll fallback to the old custom component stack format parsing.
176
236
  const stack = parseErrorStack(message);
177
237
  if (stack && stack.length > 0) {
178
- return stack.map(frame => ({
179
- content: frame.methodName,
180
- collapse: frame.collapse || false,
181
- fileName: frame.file == null ? 'unknown' : frame.file,
182
- location: {
183
- column: frame.column == null ? -1 : frame.column,
184
- row: frame.lineNumber == null ? -1 : frame.lineNumber,
185
- },
186
- }));
238
+ return {
239
+ type: 'stack',
240
+ stack: stack.map(frame => ({
241
+ content: frame.methodName,
242
+ collapse: frame.collapse || false,
243
+ fileName: frame.file == null ? 'unknown' : frame.file,
244
+ location: {
245
+ column: frame.column == null ? -1 : frame.column,
246
+ row: frame.lineNumber == null ? -1 : frame.lineNumber,
247
+ },
248
+ })),
249
+ };
187
250
  }
188
-
189
- return message
190
- .split(/\n {4}in /g)
251
+ const legacyStack = message
252
+ .split(RE_COMPONENT_STACK_LINE_GLOBAL)
191
253
  .map(s => {
192
254
  if (!s) {
193
255
  return null;
194
256
  }
195
- const match = s.match(/(.*) \(at (.*\.(?:js|jsx|ts|tsx)):([\d]+)\)/);
196
- if (!match) {
197
- return null;
257
+ const match = s.match(RE_COMPONENT_STACK_WITH_SOURCE);
258
+ if (match) {
259
+ let [content, fileName, row] = match.slice(1);
260
+ return {
261
+ content,
262
+ fileName,
263
+ location: {column: -1, row: parseInt(row, 10)},
264
+ };
198
265
  }
199
266
 
200
- let [content, fileName, row] = match.slice(1);
201
- return {
202
- content,
203
- fileName,
204
- location: {column: -1, row: parseInt(row, 10)},
205
- };
267
+ // In some cases, the component stack doesn't have a source.
268
+ const matchWithoutSource = s.match(RE_COMPONENT_STACK_NO_SOURCE);
269
+ if (matchWithoutSource) {
270
+ return {
271
+ content: matchWithoutSource[1],
272
+ fileName: '',
273
+ location: null,
274
+ };
275
+ }
276
+
277
+ return null;
206
278
  })
207
279
  .filter(Boolean);
280
+
281
+ return {
282
+ type: 'legacy',
283
+ stack: legacyStack,
284
+ };
208
285
  }
209
286
 
210
287
  export function parseLogBoxException(
@@ -213,7 +290,7 @@ export function parseLogBoxException(
213
290
  const message =
214
291
  error.originalMessage != null ? error.originalMessage : 'Unknown';
215
292
 
216
- const metroInternalError = message.match(METRO_ERROR_FORMAT);
293
+ const metroInternalError = message.match(RE_METRO_ERROR_FORMAT);
217
294
  if (metroInternalError) {
218
295
  const [content, fileName, row, column, codeFrame] =
219
296
  metroInternalError.slice(1);
@@ -223,6 +300,7 @@ export function parseLogBoxException(
223
300
  type: 'Metro Error',
224
301
  stack: [],
225
302
  isComponentError: false,
303
+ componentStackType: 'legacy',
226
304
  componentStack: [],
227
305
  codeFrame: {
228
306
  fileName,
@@ -241,7 +319,7 @@ export function parseLogBoxException(
241
319
  };
242
320
  }
243
321
 
244
- const babelTransformError = message.match(BABEL_TRANSFORM_ERROR_FORMAT);
322
+ const babelTransformError = message.match(RE_BABEL_TRANSFORM_ERROR_FORMAT);
245
323
  if (babelTransformError) {
246
324
  // Transform errors are thrown from inside the Babel transformer.
247
325
  const [fileName, content, row, column, codeFrame] =
@@ -251,6 +329,7 @@ export function parseLogBoxException(
251
329
  level: 'syntax',
252
330
  stack: [],
253
331
  isComponentError: false,
332
+ componentStackType: 'legacy',
254
333
  componentStack: [],
255
334
  codeFrame: {
256
335
  fileName,
@@ -271,8 +350,8 @@ export function parseLogBoxException(
271
350
 
272
351
  // Perform a cheap match first before trying to parse the full message, which
273
352
  // can get expensive for arbitrary input.
274
- if (BABEL_CODE_FRAME_MARKER_PATTERN.test(message)) {
275
- const babelCodeFrameError = message.match(BABEL_CODE_FRAME_ERROR_FORMAT);
353
+ if (RE_BABEL_CODE_FRAME_MARKER_PATTERN.test(message)) {
354
+ const babelCodeFrameError = message.match(RE_BABEL_CODE_FRAME_ERROR_FORMAT);
276
355
 
277
356
  if (babelCodeFrameError) {
278
357
  // Codeframe errors are thrown from any use of buildCodeFrameError.
@@ -281,6 +360,7 @@ export function parseLogBoxException(
281
360
  level: 'syntax',
282
361
  stack: [],
283
362
  isComponentError: false,
363
+ componentStackType: 'legacy',
284
364
  componentStack: [],
285
365
  codeFrame: {
286
366
  fileName,
@@ -297,11 +377,12 @@ export function parseLogBoxException(
297
377
  }
298
378
  }
299
379
 
300
- if (message.match(/^TransformError /)) {
380
+ if (message.match(RE_TRANSFORM_ERROR)) {
301
381
  return {
302
382
  level: 'syntax',
303
383
  stack: error.stack,
304
384
  isComponentError: error.isComponentError,
385
+ componentStackType: 'legacy',
305
386
  componentStack: [],
306
387
  message: {
307
388
  content: message,
@@ -314,24 +395,39 @@ export function parseLogBoxException(
314
395
 
315
396
  const componentStack = error.componentStack;
316
397
  if (error.isFatal || error.isComponentError) {
317
- return {
318
- level: 'fatal',
319
- stack: error.stack,
320
- isComponentError: error.isComponentError,
321
- componentStack:
322
- componentStack != null ? parseComponentStack(componentStack) : [],
323
- extraData: error.extraData,
324
- ...parseInterpolation([message]),
325
- };
398
+ if (componentStack != null) {
399
+ const {type, stack} = parseComponentStack(componentStack);
400
+ return {
401
+ level: 'fatal',
402
+ stack: error.stack,
403
+ isComponentError: error.isComponentError,
404
+ componentStackType: type,
405
+ componentStack: stack,
406
+ extraData: error.extraData,
407
+ ...parseInterpolation([message]),
408
+ };
409
+ } else {
410
+ return {
411
+ level: 'fatal',
412
+ stack: error.stack,
413
+ isComponentError: error.isComponentError,
414
+ componentStackType: 'legacy',
415
+ componentStack: [],
416
+ extraData: error.extraData,
417
+ ...parseInterpolation([message]),
418
+ };
419
+ }
326
420
  }
327
421
 
328
422
  if (componentStack != null) {
329
423
  // It is possible that console errors have a componentStack.
424
+ const {type, stack} = parseComponentStack(componentStack);
330
425
  return {
331
426
  level: 'error',
332
427
  stack: error.stack,
333
428
  isComponentError: error.isComponentError,
334
- componentStack: parseComponentStack(componentStack),
429
+ componentStackType: type,
430
+ componentStack: stack,
335
431
  extraData: error.extraData,
336
432
  ...parseInterpolation([message]),
337
433
  };
@@ -348,14 +444,28 @@ export function parseLogBoxException(
348
444
  };
349
445
  }
350
446
 
447
+ export function withoutANSIColorStyles(message: mixed): mixed {
448
+ if (typeof message !== 'string') {
449
+ return message;
450
+ }
451
+
452
+ return message.replace(
453
+ // eslint-disable-next-line no-control-regex
454
+ /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,
455
+ '',
456
+ );
457
+ }
458
+
351
459
  export function parseLogBoxLog(args: $ReadOnlyArray<mixed>): {|
352
460
  componentStack: ComponentStack,
461
+ componentStackType: ComponentStackType,
353
462
  category: Category,
354
463
  message: Message,
355
464
  |} {
356
- const message = args[0];
465
+ const message = withoutANSIColorStyles(args[0]);
357
466
  let argsWithoutComponentStack: Array<mixed> = [];
358
467
  let componentStack: ComponentStack = [];
468
+ let componentStackType = 'legacy';
359
469
 
360
470
  // Extract component stack from warnings like "Some warning%s".
361
471
  if (
@@ -367,16 +477,18 @@ export function parseLogBoxLog(args: $ReadOnlyArray<mixed>): {|
367
477
  if (typeof lastArg === 'string' && isComponentStack(lastArg)) {
368
478
  argsWithoutComponentStack = args.slice(0, -1);
369
479
  argsWithoutComponentStack[0] = message.slice(0, -2);
370
- componentStack = parseComponentStack(lastArg);
480
+ const {type, stack} = parseComponentStack(lastArg);
481
+ componentStack = stack;
482
+ componentStackType = type;
371
483
  }
372
484
  }
373
485
 
374
- if (componentStack.length === 0) {
486
+ if (componentStack.length === 0 && argsWithoutComponentStack.length === 0) {
375
487
  // Try finding the component stack elsewhere.
376
488
  for (const arg of args) {
377
489
  if (typeof arg === 'string' && isComponentStack(arg)) {
378
490
  // Strip out any messages before the component stack.
379
- let messageEndIndex = arg.search(/\n {4}(in|at) /);
491
+ let messageEndIndex = arg.search(RE_COMPONENT_STACK_LINE);
380
492
  if (messageEndIndex < 0) {
381
493
  // Handle JSC component stacks.
382
494
  messageEndIndex = arg.search(/\n/);
@@ -385,7 +497,9 @@ export function parseLogBoxLog(args: $ReadOnlyArray<mixed>): {|
385
497
  argsWithoutComponentStack.push(arg.slice(0, messageEndIndex));
386
498
  }
387
499
 
388
- componentStack = parseComponentStack(arg);
500
+ const {type, stack} = parseComponentStack(arg);
501
+ componentStack = stack;
502
+ componentStackType = type;
389
503
  } else {
390
504
  argsWithoutComponentStack.push(arg);
391
505
  }
@@ -395,5 +509,6 @@ export function parseLogBoxLog(args: $ReadOnlyArray<mixed>): {|
395
509
  return {
396
510
  ...parseInterpolation(argsWithoutComponentStack),
397
511
  componentStack,
512
+ componentStackType,
398
513
  };
399
514
  }
@@ -13,6 +13,7 @@ import type {ExtendedExceptionData} from './Data/parseLogBoxLog';
13
13
 
14
14
  import Platform from '../Utilities/Platform';
15
15
  import RCTLog from '../Utilities/RCTLog';
16
+ import {hasComponentStack} from './Data/parseLogBoxLog';
16
17
 
17
18
  export type {LogData, ExtendedExceptionData, IgnorePattern};
18
19
 
@@ -150,7 +151,8 @@ if (__DEV__) {
150
151
 
151
152
  try {
152
153
  if (!isRCTLogAdviceWarning(...args)) {
153
- const {category, message, componentStack} = parseLogBoxLog(args);
154
+ const {category, message, componentStack, componentStackType} =
155
+ parseLogBoxLog(args);
154
156
 
155
157
  if (!LogBoxData.isMessageIgnored(message.content)) {
156
158
  LogBoxData.addLog({
@@ -158,6 +160,7 @@ if (__DEV__) {
158
160
  category,
159
161
  message,
160
162
  componentStack,
163
+ componentStackType,
161
164
  });
162
165
  }
163
166
  }
@@ -176,12 +179,20 @@ if (__DEV__) {
176
179
  }
177
180
 
178
181
  try {
179
- if (!isWarningModuleWarning(...args)) {
180
- // Only show LogBox for the 'warning' module, otherwise pass through.
182
+ if (!isWarningModuleWarning(...args) && !hasComponentStack(args)) {
183
+ // Only show LogBox for the 'warning' module, or React errors with
184
+ // component stacks, otherwise pass the error through.u
185
+ //
181
186
  // By passing through, this will get picked up by the React console override,
182
187
  // potentially adding the component stack. React then passes it back to the
183
188
  // React Native ExceptionsManager, which reports it to LogBox as an error.
184
189
  //
190
+ // Ideally, we refactor all RN error handling so that LogBox patching
191
+ // errors is not necessary, and they are reported the same as a framework.
192
+ // The blocker to this is that the ExceptionManager console.error override
193
+ // strigifys all of the args before passing it through to LogBox, which
194
+ // would lose all of the interpolation information.
195
+ //
185
196
  // The 'warning' module needs to be handled here because React internally calls
186
197
  // `console.error('Warning: ')` with the component stack already included.
187
198
  originalConsoleError(...args);
@@ -190,20 +201,25 @@ if (__DEV__) {
190
201
 
191
202
  const format = args[0].replace('Warning: ', '');
192
203
  const filterResult = LogBoxData.checkWarningFilter(format);
193
- if (filterResult.suppressCompletely) {
194
- return;
195
- }
196
-
197
204
  let level = 'error';
198
- if (filterResult.suppressDialog_LEGACY === true) {
199
- level = 'warn';
200
- } else if (filterResult.forceDialogImmediately === true) {
201
- level = 'fatal'; // Do not downgrade. These are real bugs with same severity as throws.
205
+ if (filterResult.monitorEvent !== 'warning_unhandled') {
206
+ if (filterResult.suppressCompletely) {
207
+ return;
208
+ }
209
+
210
+ if (filterResult.suppressDialog_LEGACY === true) {
211
+ level = 'warn';
212
+ } else if (filterResult.forceDialogImmediately === true) {
213
+ level = 'fatal'; // Do not downgrade. These are real bugs with same severity as throws.
214
+ }
202
215
  }
203
216
 
204
217
  // Unfortunately, we need to add the Warning: prefix back for downstream dependencies.
218
+ // Downstream, we check for this prefix to know that LogBox already handled it, so
219
+ // it doesn't get reported back to LogBox. It's an absolute mess.
205
220
  args[0] = `Warning: ${filterResult.finalFormat}`;
206
- const {category, message, componentStack} = parseLogBoxLog(args);
221
+ const {category, message, componentStack, componentStackType} =
222
+ parseLogBoxLog(args);
207
223
 
208
224
  // Interpolate the message so they are formatted for adb and other CLIs.
209
225
  // This is different than the message.content above because it includes component stacks.
@@ -216,6 +232,7 @@ if (__DEV__) {
216
232
  category,
217
233
  message,
218
234
  componentStack,
235
+ componentStackType,
219
236
  });
220
237
  }
221
238
  } catch (err) {
@@ -36,6 +36,10 @@ export function _LogBoxNotificationContainer(props: Props): React.Node {
36
36
  };
37
37
 
38
38
  function openLog(log: LogBoxLog) {
39
+ if (log.onNotificationPress) {
40
+ log.onNotificationPress();
41
+ return;
42
+ }
39
43
  let index = logs.length - 1;
40
44
 
41
45
  // Stop at zero because if we don't find any log, we'll open the first log.