react-native 0.85.2 → 0.85.3

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 (108) hide show
  1. package/Libraries/Core/ReactNativeVersion.js +1 -1
  2. package/Libraries/Utilities/HMRClient.js +28 -1
  3. package/React/Base/RCTVersion.m +1 -1
  4. package/React/CoreModules/RCTJscSafeUrl+Internal.h +23 -0
  5. package/React/CoreModules/RCTJscSafeUrl.mm +38 -0
  6. package/React/CoreModules/RCTRedBox+Internal.h +42 -0
  7. package/React/CoreModules/RCTRedBox.mm +30 -454
  8. package/React/CoreModules/RCTRedBox2AnsiParser+Internal.h +22 -0
  9. package/React/CoreModules/RCTRedBox2AnsiParser.mm +55 -0
  10. package/React/CoreModules/RCTRedBox2Controller+Internal.h +34 -0
  11. package/React/CoreModules/RCTRedBox2Controller.mm +764 -0
  12. package/React/CoreModules/RCTRedBox2ErrorParser+Internal.h +46 -0
  13. package/React/CoreModules/RCTRedBox2ErrorParser.mm +57 -0
  14. package/React/CoreModules/RCTRedBoxController+Internal.h +31 -0
  15. package/React/CoreModules/RCTRedBoxController.mm +447 -0
  16. package/React/CoreModules/RCTRedBoxHMRClient+Internal.h +26 -0
  17. package/React/CoreModules/RCTRedBoxHMRClient.mm +125 -0
  18. package/React/CoreModules/React-CoreModules.podspec +1 -0
  19. package/React/DevSupport/RCTFrameTimingsObserver.h +24 -0
  20. package/React/DevSupport/RCTFrameTimingsObserver.mm +298 -0
  21. package/React/FBReactNativeSpec/FBReactNativeSpecJSI.h +40 -0
  22. package/ReactAndroid/gradle.properties +1 -1
  23. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/InspectorFlags.kt +4 -0
  24. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/inspector/FrameTimingSequence.kt +1 -1
  25. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/inspector/FrameTimingsObserver.kt +127 -26
  26. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +31 -1
  27. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +51 -1
  28. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +11 -1
  29. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +11 -1
  30. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +56 -1
  31. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +11 -1
  32. package/ReactAndroid/src/main/java/com/facebook/react/internal/tracing/PerformanceTracer.kt +39 -0
  33. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
  34. package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.kt +50 -10
  35. package/ReactAndroid/src/main/jni/CMakeLists.txt +7 -0
  36. package/ReactAndroid/src/main/jni/react/devsupport/JInspectorFlags.cpp +22 -0
  37. package/ReactAndroid/src/main/jni/react/devsupport/JInspectorFlags.h +2 -0
  38. package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +71 -1
  39. package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +16 -1
  40. package/ReactAndroid/src/main/jni/react/runtime/jni/JReactHostInspectorTarget.cpp +14 -0
  41. package/ReactAndroid/src/main/jni/react/runtime/jni/JReactHostInspectorTarget.h +18 -4
  42. package/ReactCommon/React-Fabric.podspec +6 -0
  43. package/ReactCommon/cxxreact/ReactNativeVersion.h +2 -2
  44. package/ReactCommon/jsinspector-modern/HostAgent.cpp +36 -0
  45. package/ReactCommon/jsinspector-modern/HostTarget.cpp +7 -1
  46. package/ReactCommon/jsinspector-modern/HostTarget.h +25 -0
  47. package/ReactCommon/jsinspector-modern/HostTargetTracing.cpp +1 -1
  48. package/ReactCommon/jsinspector-modern/HostTargetTracing.h +4 -4
  49. package/ReactCommon/jsinspector-modern/InspectorFlags.cpp +12 -0
  50. package/ReactCommon/jsinspector-modern/InspectorFlags.h +12 -0
  51. package/ReactCommon/jsinspector-modern/NetworkIOAgent.cpp +1 -1
  52. package/ReactCommon/jsinspector-modern/RuntimeAgent.cpp +19 -0
  53. package/ReactCommon/jsinspector-modern/RuntimeAgent.h +7 -0
  54. package/ReactCommon/jsinspector-modern/RuntimeTarget.cpp +33 -0
  55. package/ReactCommon/jsinspector-modern/RuntimeTarget.h +6 -0
  56. package/ReactCommon/jsinspector-modern/tests/HostTargetTest.cpp +12 -0
  57. package/ReactCommon/jsinspector-modern/tests/InspectorMocks.h +3 -2
  58. package/ReactCommon/jsinspector-modern/tests/JsiIntegrationTest.cpp +1 -0
  59. package/ReactCommon/jsinspector-modern/tests/NetworkReporterTest.cpp +1 -1
  60. package/ReactCommon/jsinspector-modern/tests/TracingTest.cpp +1 -1
  61. package/ReactCommon/jsinspector-modern/tests/utils/InspectorFlagOverridesGuard.cpp +10 -0
  62. package/ReactCommon/jsinspector-modern/tests/utils/InspectorFlagOverridesGuard.h +3 -1
  63. package/ReactCommon/jsinspector-modern/tracing/CMakeLists.txt +1 -0
  64. package/ReactCommon/jsinspector-modern/tracing/FrameTimingSequence.h +7 -3
  65. package/ReactCommon/jsinspector-modern/tracing/HostTracingProfileSerializer.cpp +52 -29
  66. package/ReactCommon/jsinspector-modern/tracing/HostTracingProfileSerializer.h +6 -6
  67. package/ReactCommon/jsinspector-modern/tracing/PerformanceTracerSection.h +113 -0
  68. package/ReactCommon/jsinspector-modern/tracing/React-jsinspectortracing.podspec +1 -0
  69. package/ReactCommon/jsinspector-modern/tracing/TraceEventGenerator.cpp +12 -5
  70. package/ReactCommon/jsinspector-modern/tracing/TraceEventGenerator.h +3 -1
  71. package/ReactCommon/jsinspector-modern/tracing/TraceEventSerializer.cpp +42 -0
  72. package/ReactCommon/jsinspector-modern/tracing/TraceEventSerializer.h +7 -0
  73. package/ReactCommon/react/debug/CMakeLists.txt +2 -1
  74. package/ReactCommon/react/debug/React-debug.podspec +7 -1
  75. package/ReactCommon/react/debug/redbox/AnsiParser.cpp +139 -0
  76. package/ReactCommon/react/debug/redbox/AnsiParser.h +35 -0
  77. package/ReactCommon/react/debug/redbox/JscSafeUrl.cpp +179 -0
  78. package/ReactCommon/react/debug/redbox/JscSafeUrl.h +27 -0
  79. package/ReactCommon/react/debug/redbox/RedBoxErrorParser.cpp +171 -0
  80. package/ReactCommon/react/debug/redbox/RedBoxErrorParser.h +40 -0
  81. package/ReactCommon/react/debug/redbox/tests/AnsiParserTest.cpp +97 -0
  82. package/ReactCommon/react/debug/redbox/tests/JscSafeUrlTest.cpp +173 -0
  83. package/ReactCommon/react/debug/redbox/tests/RedBoxErrorParserTest.cpp +107 -0
  84. package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +21 -1
  85. package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +26 -1
  86. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +135 -45
  87. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +12 -2
  88. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +21 -1
  89. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +46 -1
  90. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +6 -1
  91. package/ReactCommon/react/nativemodule/defaults/CMakeLists.txt +1 -0
  92. package/ReactCommon/react/nativemodule/defaults/DefaultTurboModules.cpp +7 -0
  93. package/ReactCommon/react/nativemodule/defaults/React-defaultsnativemodule.podspec +1 -0
  94. package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +26 -1
  95. package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +11 -1
  96. package/ReactCommon/react/nativemodule/mutationobserver/NativeMutationObserver.h +4 -0
  97. package/ReactCommon/react/nativemodule/mutationobserver/React-mutationobservernativemodule.podspec +66 -0
  98. package/ReactCommon/react/performance/timeline/PerformanceObserver.cpp +18 -6
  99. package/ReactCommon/react/performance/timeline/PerformanceObserver.h +2 -0
  100. package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.mm +115 -0
  101. package/ReactCommon/{jsinspector-modern → react/utils}/Base64.h +2 -2
  102. package/package.json +11 -11
  103. package/scripts/cocoapods/utils.rb +1 -0
  104. package/scripts/react_native_pods.rb +1 -0
  105. package/scripts/replace-rncore-version.js +72 -15
  106. package/src/private/featureflags/ReactNativeFeatureFlags.js +26 -1
  107. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +6 -1
  108. package/src/private/setup/setUpDefaultReactNativeEnvironment.js +6 -0
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<db6a2d2e1d96e088574d91ae2825fe5e>>
7
+ * @generated SignedSource<<e2a6a7a32ffbf20eb8906dfa526a5f9b>>
8
8
  */
9
9
 
10
10
  /**
@@ -414,6 +414,15 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef
414
414
  return ReactNativeFeatureFlagsDefaults::enableModuleArgumentNSNullConversionIOS();
415
415
  }
416
416
 
417
+ bool enableMutationObserverByDefault() override {
418
+ auto value = values_["enableMutationObserverByDefault"];
419
+ if (!value.isNull()) {
420
+ return value.getBool();
421
+ }
422
+
423
+ return ReactNativeFeatureFlagsDefaults::enableMutationObserverByDefault();
424
+ }
425
+
417
426
  bool enableNativeCSSParsing() override {
418
427
  auto value = values_["enableNativeCSSParsing"];
419
428
  if (!value.isNull()) {
@@ -576,6 +585,15 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef
576
585
  return ReactNativeFeatureFlagsDefaults::fuseboxEnabledRelease();
577
586
  }
578
587
 
588
+ bool fuseboxFrameRecordingEnabled() override {
589
+ auto value = values_["fuseboxFrameRecordingEnabled"];
590
+ if (!value.isNull()) {
591
+ return value.getBool();
592
+ }
593
+
594
+ return ReactNativeFeatureFlagsDefaults::fuseboxFrameRecordingEnabled();
595
+ }
596
+
579
597
  bool fuseboxNetworkInspectionEnabled() override {
580
598
  auto value = values_["fuseboxNetworkInspectionEnabled"];
581
599
  if (!value.isNull()) {
@@ -585,6 +603,15 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef
585
603
  return ReactNativeFeatureFlagsDefaults::fuseboxNetworkInspectionEnabled();
586
604
  }
587
605
 
606
+ bool fuseboxScreenshotCaptureEnabled() override {
607
+ auto value = values_["fuseboxScreenshotCaptureEnabled"];
608
+ if (!value.isNull()) {
609
+ return value.getBool();
610
+ }
611
+
612
+ return ReactNativeFeatureFlagsDefaults::fuseboxScreenshotCaptureEnabled();
613
+ }
614
+
588
615
  bool hideOffscreenVirtualViewsOnIOS() override {
589
616
  auto value = values_["hideOffscreenVirtualViewsOnIOS"];
590
617
  if (!value.isNull()) {
@@ -639,6 +666,24 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef
639
666
  return ReactNativeFeatureFlagsDefaults::preventShadowTreeCommitExhaustion();
640
667
  }
641
668
 
669
+ bool redBoxV2Android() override {
670
+ auto value = values_["redBoxV2Android"];
671
+ if (!value.isNull()) {
672
+ return value.getBool();
673
+ }
674
+
675
+ return ReactNativeFeatureFlagsDefaults::redBoxV2Android();
676
+ }
677
+
678
+ bool redBoxV2IOS() override {
679
+ auto value = values_["redBoxV2IOS"];
680
+ if (!value.isNull()) {
681
+ return value.getBool();
682
+ }
683
+
684
+ return ReactNativeFeatureFlagsDefaults::redBoxV2IOS();
685
+ }
686
+
642
687
  bool shouldPressibilityUseW3CPointerEventsForHover() override {
643
688
  auto value = values_["shouldPressibilityUseW3CPointerEventsForHover"];
644
689
  if (!value.isNull()) {
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<43e301c5028a2ed195e2a3d0a4cd0ab3>>
7
+ * @generated SignedSource<<ba443ccb843898a70e1968ba5d4ab62c>>
8
8
  */
9
9
 
10
10
  /**
@@ -66,6 +66,7 @@ class ReactNativeFeatureFlagsProvider {
66
66
  virtual bool enableLayoutAnimationsOnIOS() = 0;
67
67
  virtual bool enableMainQueueCoordinatorOnIOS() = 0;
68
68
  virtual bool enableModuleArgumentNSNullConversionIOS() = 0;
69
+ virtual bool enableMutationObserverByDefault() = 0;
69
70
  virtual bool enableNativeCSSParsing() = 0;
70
71
  virtual bool enableNetworkEventReporting() = 0;
71
72
  virtual bool enablePreparedTextLayout() = 0;
@@ -84,13 +85,17 @@ class ReactNativeFeatureFlagsProvider {
84
85
  virtual bool fixTextClippingAndroid15useBoundsForWidth() = 0;
85
86
  virtual bool fuseboxAssertSingleHostState() = 0;
86
87
  virtual bool fuseboxEnabledRelease() = 0;
88
+ virtual bool fuseboxFrameRecordingEnabled() = 0;
87
89
  virtual bool fuseboxNetworkInspectionEnabled() = 0;
90
+ virtual bool fuseboxScreenshotCaptureEnabled() = 0;
88
91
  virtual bool hideOffscreenVirtualViewsOnIOS() = 0;
89
92
  virtual bool overrideBySynchronousMountPropsAtMountingAndroid() = 0;
90
93
  virtual bool perfIssuesEnabled() = 0;
91
94
  virtual bool perfMonitorV2Enabled() = 0;
92
95
  virtual double preparedTextCacheSize() = 0;
93
96
  virtual bool preventShadowTreeCommitExhaustion() = 0;
97
+ virtual bool redBoxV2Android() = 0;
98
+ virtual bool redBoxV2IOS() = 0;
94
99
  virtual bool shouldPressibilityUseW3CPointerEventsForHover() = 0;
95
100
  virtual bool shouldTriggerResponderTransferOnScrollAndroid() = 0;
96
101
  virtual bool skipActivityIdentityAssertionOnHostPause() = 0;
@@ -22,6 +22,7 @@ target_link_libraries(react_nativemodule_defaults
22
22
  react_nativemodule_microtasks
23
23
  react_nativemodule_idlecallbacks
24
24
  react_nativemodule_intersectionobserver
25
+ react_nativemodule_mutationobserver
25
26
  react_nativemodule_webperformance
26
27
  react_renderer_animated
27
28
  )
@@ -12,6 +12,7 @@
12
12
  #include <react/nativemodule/idlecallbacks/NativeIdleCallbacks.h>
13
13
  #include <react/nativemodule/intersectionobserver/NativeIntersectionObserver.h>
14
14
  #include <react/nativemodule/microtasks/NativeMicrotasks.h>
15
+ #include <react/nativemodule/mutationobserver/NativeMutationObserver.h>
15
16
  #include <react/nativemodule/webperformance/NativePerformance.h>
16
17
  #include <react/renderer/animated/AnimatedModule.h>
17
18
 
@@ -50,6 +51,12 @@ namespace facebook::react {
50
51
  }
51
52
  }
52
53
 
54
+ if (ReactNativeFeatureFlags::enableMutationObserverByDefault()) {
55
+ if (name == NativeMutationObserver::kModuleName) {
56
+ return std::make_shared<NativeMutationObserver>(jsInvoker);
57
+ }
58
+ }
59
+
53
60
  if (ReactNativeFeatureFlags::cxxNativeAnimatedEnabled() &&
54
61
  ReactNativeFeatureFlags::useSharedAnimatedBackend() &&
55
62
  name == AnimatedModule::kModuleName) {
@@ -53,6 +53,7 @@ Pod::Spec.new do |s|
53
53
  s.dependency "React-microtasksnativemodule"
54
54
  s.dependency "React-idlecallbacksnativemodule"
55
55
  s.dependency "React-intersectionobservernativemodule"
56
+ s.dependency "React-mutationobservernativemodule"
56
57
  s.dependency "React-webperformancenativemodule"
57
58
  s.dependency "React-Fabric/animated"
58
59
  add_dependency(s, "React-RCTFBReactNativeSpec")
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<006c43555032f785207c6c013f1974f5>>
7
+ * @generated SignedSource<<4dd16dbf31dc31860960aa2abcb7862d>>
8
8
  */
9
9
 
10
10
  /**
@@ -249,6 +249,11 @@ bool NativeReactNativeFeatureFlags::enableModuleArgumentNSNullConversionIOS(
249
249
  return ReactNativeFeatureFlags::enableModuleArgumentNSNullConversionIOS();
250
250
  }
251
251
 
252
+ bool NativeReactNativeFeatureFlags::enableMutationObserverByDefault(
253
+ jsi::Runtime& /*runtime*/) {
254
+ return ReactNativeFeatureFlags::enableMutationObserverByDefault();
255
+ }
256
+
252
257
  bool NativeReactNativeFeatureFlags::enableNativeCSSParsing(
253
258
  jsi::Runtime& /*runtime*/) {
254
259
  return ReactNativeFeatureFlags::enableNativeCSSParsing();
@@ -339,11 +344,21 @@ bool NativeReactNativeFeatureFlags::fuseboxEnabledRelease(
339
344
  return ReactNativeFeatureFlags::fuseboxEnabledRelease();
340
345
  }
341
346
 
347
+ bool NativeReactNativeFeatureFlags::fuseboxFrameRecordingEnabled(
348
+ jsi::Runtime& /*runtime*/) {
349
+ return ReactNativeFeatureFlags::fuseboxFrameRecordingEnabled();
350
+ }
351
+
342
352
  bool NativeReactNativeFeatureFlags::fuseboxNetworkInspectionEnabled(
343
353
  jsi::Runtime& /*runtime*/) {
344
354
  return ReactNativeFeatureFlags::fuseboxNetworkInspectionEnabled();
345
355
  }
346
356
 
357
+ bool NativeReactNativeFeatureFlags::fuseboxScreenshotCaptureEnabled(
358
+ jsi::Runtime& /*runtime*/) {
359
+ return ReactNativeFeatureFlags::fuseboxScreenshotCaptureEnabled();
360
+ }
361
+
347
362
  bool NativeReactNativeFeatureFlags::hideOffscreenVirtualViewsOnIOS(
348
363
  jsi::Runtime& /*runtime*/) {
349
364
  return ReactNativeFeatureFlags::hideOffscreenVirtualViewsOnIOS();
@@ -374,6 +389,16 @@ bool NativeReactNativeFeatureFlags::preventShadowTreeCommitExhaustion(
374
389
  return ReactNativeFeatureFlags::preventShadowTreeCommitExhaustion();
375
390
  }
376
391
 
392
+ bool NativeReactNativeFeatureFlags::redBoxV2Android(
393
+ jsi::Runtime& /*runtime*/) {
394
+ return ReactNativeFeatureFlags::redBoxV2Android();
395
+ }
396
+
397
+ bool NativeReactNativeFeatureFlags::redBoxV2IOS(
398
+ jsi::Runtime& /*runtime*/) {
399
+ return ReactNativeFeatureFlags::redBoxV2IOS();
400
+ }
401
+
377
402
  bool NativeReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover(
378
403
  jsi::Runtime& /*runtime*/) {
379
404
  return ReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover();
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<525d64b15e1b72440743363280116c6a>>
7
+ * @generated SignedSource<<ed4a87c5d258ebf5aa61e7d74d1b09be>>
8
8
  */
9
9
 
10
10
  /**
@@ -118,6 +118,8 @@ class NativeReactNativeFeatureFlags
118
118
 
119
119
  bool enableModuleArgumentNSNullConversionIOS(jsi::Runtime& runtime);
120
120
 
121
+ bool enableMutationObserverByDefault(jsi::Runtime& runtime);
122
+
121
123
  bool enableNativeCSSParsing(jsi::Runtime& runtime);
122
124
 
123
125
  bool enableNetworkEventReporting(jsi::Runtime& runtime);
@@ -154,8 +156,12 @@ class NativeReactNativeFeatureFlags
154
156
 
155
157
  bool fuseboxEnabledRelease(jsi::Runtime& runtime);
156
158
 
159
+ bool fuseboxFrameRecordingEnabled(jsi::Runtime& runtime);
160
+
157
161
  bool fuseboxNetworkInspectionEnabled(jsi::Runtime& runtime);
158
162
 
163
+ bool fuseboxScreenshotCaptureEnabled(jsi::Runtime& runtime);
164
+
159
165
  bool hideOffscreenVirtualViewsOnIOS(jsi::Runtime& runtime);
160
166
 
161
167
  bool overrideBySynchronousMountPropsAtMountingAndroid(jsi::Runtime& runtime);
@@ -168,6 +174,10 @@ class NativeReactNativeFeatureFlags
168
174
 
169
175
  bool preventShadowTreeCommitExhaustion(jsi::Runtime& runtime);
170
176
 
177
+ bool redBoxV2Android(jsi::Runtime& runtime);
178
+
179
+ bool redBoxV2IOS(jsi::Runtime& runtime);
180
+
171
181
  bool shouldPressibilityUseW3CPointerEventsForHover(jsi::Runtime& runtime);
172
182
 
173
183
  bool shouldTriggerResponderTransferOnScrollAndroid(jsi::Runtime& runtime);
@@ -7,7 +7,11 @@
7
7
 
8
8
  #pragma once
9
9
 
10
+ #if __has_include("FBReactNativeSpecJSI.h") // CocoaPod headers on Apple
11
+ #include "FBReactNativeSpecJSI.h"
12
+ #else
10
13
  #include <FBReactNativeSpec/FBReactNativeSpecJSI.h>
14
+ #endif
11
15
  #include <react/renderer/bridging/bridging.h>
12
16
  #include <react/renderer/observers/mutation/MutationObserverManager.h>
13
17
  #include <react/renderer/uimanager/UIManager.h>
@@ -0,0 +1,66 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ #
3
+ # This source code is licensed under the MIT license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+ require "json"
7
+
8
+ package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "..", "package.json")))
9
+ version = package['version']
10
+
11
+ source = { :git => 'https://github.com/facebook/react-native.git' }
12
+ if version == '1000.0.0'
13
+ # This is an unpublished version, use the latest commit hash of the react-native repo, which we're presumably in.
14
+ source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
15
+ else
16
+ source[:tag] = "v#{version}"
17
+ end
18
+
19
+ header_search_paths = [
20
+ "\"$(PODS_ROOT)/Headers/Private/Yoga\"",
21
+ ]
22
+
23
+ if ENV['USE_FRAMEWORKS']
24
+ header_search_paths << "\"$(PODS_TARGET_SRCROOT)/../../..\"" # this is needed to allow the module access its own files
25
+ end
26
+
27
+ Pod::Spec.new do |s|
28
+ s.name = "React-mutationobservernativemodule"
29
+ s.version = version
30
+ s.summary = "React Native mutation observer native module"
31
+ s.homepage = "https://reactnative.dev/"
32
+ s.license = package["license"]
33
+ s.author = "Meta Platforms, Inc. and its affiliates"
34
+ s.platforms = min_supported_versions
35
+ s.source = source
36
+ s.source_files = podspec_sources("*.{cpp,h}", "*.h")
37
+ s.header_dir = "react/nativemodule/mutationobserver"
38
+ s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
39
+ "HEADER_SEARCH_PATHS" => header_search_paths.join(' '),
40
+ "OTHER_CFLAGS" => "$(inherited)",
41
+ "DEFINES_MODULE" => "YES" }
42
+
43
+ if ENV['USE_FRAMEWORKS']
44
+ s.module_name = "mutationobservernativemodule"
45
+ s.header_mappings_dir = "../.."
46
+ end
47
+
48
+ s.dependency "Yoga"
49
+ s.dependency "React-jsi"
50
+ s.dependency "React-jsiexecutor"
51
+ s.dependency "React-cxxreact"
52
+
53
+ depend_on_js_engine(s)
54
+ add_rn_third_party_dependencies(s)
55
+ add_rncore_dependency(s)
56
+
57
+ s.dependency "ReactCommon/turbomodule/core"
58
+
59
+ s.dependency "React-Fabric"
60
+ s.dependency "React-Fabric/bridging"
61
+ s.dependency "React-Fabric/observers/mutation"
62
+ s.dependency "React-featureflags"
63
+ add_dependency(s, "React-RCTFBReactNativeSpec")
64
+ add_dependency(s, "React-runtimeexecutor", :additional_framework_paths => ["platform/ios"])
65
+
66
+ end
@@ -25,16 +25,21 @@ void PerformanceObserver::handleEntry(const PerformanceEntry& entry) {
25
25
  return;
26
26
  }
27
27
 
28
- buffer_.push_back(entry);
28
+ {
29
+ std::lock_guard lock(bufferMutex_);
30
+ buffer_.push_back(entry);
31
+ }
29
32
  scheduleFlushBuffer();
30
33
  }
31
34
  }
32
35
 
33
36
  std::vector<PerformanceEntry> PerformanceObserver::takeRecords() {
34
37
  std::vector<PerformanceEntry> result;
35
- buffer_.swap(result);
36
-
37
- didScheduleFlushBuffer_ = false;
38
+ {
39
+ std::lock_guard lock(bufferMutex_);
40
+ buffer_.swap(result);
41
+ didScheduleFlushBuffer_ = false;
42
+ }
38
43
 
39
44
  return result;
40
45
  }
@@ -87,9 +92,16 @@ void PerformanceObserver::disconnect() noexcept {
87
92
  }
88
93
 
89
94
  void PerformanceObserver::scheduleFlushBuffer() {
90
- if (!didScheduleFlushBuffer_) {
91
- didScheduleFlushBuffer_ = true;
95
+ bool shouldSchedule = false;
96
+ {
97
+ std::lock_guard lock(bufferMutex_);
98
+ if (!didScheduleFlushBuffer_) {
99
+ didScheduleFlushBuffer_ = true;
100
+ shouldSchedule = true;
101
+ }
102
+ }
92
103
 
104
+ if (shouldSchedule) {
93
105
  callback_();
94
106
  }
95
107
  }
@@ -14,6 +14,7 @@
14
14
 
15
15
  #include <functional>
16
16
  #include <memory>
17
+ #include <mutex>
17
18
  #include <unordered_set>
18
19
  #include <vector>
19
20
 
@@ -126,6 +127,7 @@ class PerformanceObserver : public std::enable_shared_from_this<PerformanceObser
126
127
 
127
128
  /// https://www.w3.org/TR/event-timing/#sec-modifications-perf-timeline
128
129
  HighResDuration durationThreshold_ = DEFAULT_DURATION_THRESHOLD;
130
+ std::mutex bufferMutex_;
129
131
  std::vector<PerformanceEntry> buffer_;
130
132
  bool didScheduleFlushBuffer_ = false;
131
133
  bool requiresDroppedEntries_ = false;
@@ -13,6 +13,7 @@
13
13
  #import <React/RCTConvert.h>
14
14
  #import <React/RCTDevMenu.h>
15
15
  #import <React/RCTFabricSurface.h>
16
+ #import <React/RCTFrameTimingsObserver.h>
16
17
  #import <React/RCTInspectorDevServerHelper.h>
17
18
  #import <React/RCTInspectorNetworkHelper.h>
18
19
  #import <React/RCTInspectorUtils.h>
@@ -37,12 +38,52 @@ using namespace facebook::react;
37
38
  @property (nonatomic, readonly) jsinspector_modern::HostTarget *inspectorTarget;
38
39
  @end
39
40
 
41
+ #if TARGET_OS_IPHONE && defined(REACT_NATIVE_DEBUGGER_ENABLED)
42
+ class RCTHostTracingDelegate : public jsinspector_modern::HostTargetTracingDelegate {
43
+ public:
44
+ explicit RCTHostTracingDelegate(RCTHost *host) : host_(host) {}
45
+
46
+ void onTracingStarted(jsinspector_modern::tracing::Mode /*tracingMode*/, bool screenshotsCategoryEnabled) override
47
+ {
48
+ RCTHost *host = host_;
49
+ if (host == nil || host.inspectorTarget == nullptr) {
50
+ return;
51
+ }
52
+ __weak RCTHost *weakHost = host;
53
+
54
+ observer_ = [[RCTFrameTimingsObserver alloc]
55
+ initWithScreenshotsEnabled:screenshotsCategoryEnabled
56
+ callback:^(jsinspector_modern::tracing::FrameTimingSequence sequence) {
57
+ RCTHost *strongHost = weakHost;
58
+ if (strongHost != nil && strongHost.inspectorTarget != nullptr) {
59
+ strongHost.inspectorTarget->recordFrameTimings(std::move(sequence));
60
+ }
61
+ }];
62
+ [observer_ start];
63
+ }
64
+
65
+ void onTracingStopped() override
66
+ {
67
+ [observer_ stop];
68
+ observer_ = nil;
69
+ }
70
+
71
+ private:
72
+ __weak RCTHost *host_;
73
+ RCTFrameTimingsObserver *observer_{nil};
74
+ };
75
+ #endif
76
+
40
77
  class RCTHostHostTargetDelegate : public facebook::react::jsinspector_modern::HostTargetDelegate {
41
78
  public:
42
79
  RCTHostHostTargetDelegate(RCTHost *host)
43
80
  : host_(host),
44
81
  pauseOverlayController_([[RCTPausedInDebuggerOverlayController alloc] init]),
45
82
  networkHelper_([[RCTInspectorNetworkHelper alloc] init])
83
+ #if TARGET_OS_IPHONE && defined(REACT_NATIVE_DEBUGGER_ENABLED)
84
+ ,
85
+ tracingDelegate_(host)
86
+ #endif
46
87
  {
47
88
  }
48
89
 
@@ -100,10 +141,84 @@ class RCTHostHostTargetDelegate : public facebook::react::jsinspector_modern::Ho
100
141
  [networkHelper_ loadNetworkResourceWithParams:params executor:executor];
101
142
  }
102
143
 
144
+ #if TARGET_OS_IPHONE && defined(REACT_NATIVE_DEBUGGER_ENABLED)
145
+ std::optional<std::string> captureScreenshot(const PageCaptureScreenshotRequest &request) override
146
+ {
147
+ UIWindow *keyWindow = nil;
148
+ for (UIScene *scene in UIApplication.sharedApplication.connectedScenes) {
149
+ if (scene.activationState == UISceneActivationStateForegroundActive &&
150
+ [scene isKindOfClass:[UIWindowScene class]]) {
151
+ auto *windowScene = (UIWindowScene *)scene;
152
+ for (UIWindow *win in windowScene.windows) {
153
+ if (win.isKeyWindow) {
154
+ keyWindow = win;
155
+ break;
156
+ }
157
+ }
158
+ }
159
+ if (keyWindow != nil) {
160
+ break;
161
+ }
162
+ }
163
+
164
+ if (keyWindow == nil) {
165
+ return std::nullopt;
166
+ }
167
+
168
+ UIView *rootView = keyWindow.rootViewController.view != nil ? keyWindow.rootViewController.view : keyWindow;
169
+ CGSize viewSize = rootView.bounds.size;
170
+
171
+ UIGraphicsImageRendererFormat *format = [UIGraphicsImageRendererFormat defaultFormat];
172
+ format.scale = 1.0;
173
+ UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:viewSize format:format];
174
+
175
+ UIImage *image = [renderer imageWithActions:^(UIGraphicsImageRendererContext *context) {
176
+ [rootView drawViewHierarchyInRect:CGRectMake(0, 0, viewSize.width, viewSize.height) afterScreenUpdates:NO];
177
+ }];
178
+
179
+ if (image == nil) {
180
+ return std::nullopt;
181
+ }
182
+
183
+ NSData *encodedData = nil;
184
+ std::string formatStr = request.format.value_or("png");
185
+
186
+ if (formatStr == "jpeg") {
187
+ CGFloat quality = request.quality.has_value() ? (*request.quality / 100.0) : 0.8;
188
+ encodedData = UIImageJPEGRepresentation(image, quality);
189
+ } else {
190
+ // Default to PNG for "png" and "webp" (WebP encoding not available via UIKit)
191
+ encodedData = UIImagePNGRepresentation(image);
192
+ }
193
+
194
+ if (encodedData == nil) {
195
+ return std::nullopt;
196
+ }
197
+
198
+ NSString *base64String = [encodedData base64EncodedStringWithOptions:0];
199
+ return std::string([base64String UTF8String]);
200
+ }
201
+ #endif
202
+
203
+ #if TARGET_OS_IPHONE && defined(REACT_NATIVE_DEBUGGER_ENABLED)
204
+ jsinspector_modern::HostTargetTracingDelegate *getTracingDelegate() override
205
+ {
206
+ auto &inspectorFlags = jsinspector_modern::InspectorFlags::getInstance();
207
+ if (!inspectorFlags.getFrameRecordingEnabled()) {
208
+ return nullptr;
209
+ }
210
+
211
+ return &tracingDelegate_;
212
+ }
213
+ #endif
214
+
103
215
  private:
104
216
  __weak RCTHost *host_;
105
217
  RCTPausedInDebuggerOverlayController *pauseOverlayController_;
106
218
  RCTInspectorNetworkHelper *networkHelper_;
219
+ #if TARGET_OS_IPHONE && defined(REACT_NATIVE_DEBUGGER_ENABLED)
220
+ RCTHostTracingDelegate tracingDelegate_;
221
+ #endif
107
222
  };
108
223
 
109
224
  @implementation RCTHost {
@@ -10,7 +10,7 @@
10
10
  #include <string>
11
11
  #include <string_view>
12
12
 
13
- namespace facebook::react::jsinspector_modern {
13
+ namespace facebook::react {
14
14
 
15
15
  namespace {
16
16
  // Vendored from Folly
@@ -96,4 +96,4 @@ inline std::string base64Encode(const std::string_view s)
96
96
  return res;
97
97
  }
98
98
 
99
- } // namespace facebook::react::jsinspector_modern
99
+ } // namespace facebook::react
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native",
3
- "version": "0.85.2",
3
+ "version": "0.85.3",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -149,7 +149,7 @@
149
149
  "featureflags": "node ./scripts/featureflags/index.js"
150
150
  },
151
151
  "peerDependencies": {
152
- "@react-native/jest-preset": "0.85.2",
152
+ "@react-native/jest-preset": "0.85.3",
153
153
  "@types/react": "^19.1.1",
154
154
  "react": "^19.2.3"
155
155
  },
@@ -162,13 +162,13 @@
162
162
  }
163
163
  },
164
164
  "dependencies": {
165
- "@react-native/assets-registry": "0.85.2",
166
- "@react-native/codegen": "0.85.2",
167
- "@react-native/community-cli-plugin": "0.85.2",
168
- "@react-native/gradle-plugin": "0.85.2",
169
- "@react-native/js-polyfills": "0.85.2",
170
- "@react-native/normalize-colors": "0.85.2",
171
- "@react-native/virtualized-lists": "0.85.2",
165
+ "@react-native/assets-registry": "0.85.3",
166
+ "@react-native/codegen": "0.85.3",
167
+ "@react-native/community-cli-plugin": "0.85.3",
168
+ "@react-native/gradle-plugin": "0.85.3",
169
+ "@react-native/js-polyfills": "0.85.3",
170
+ "@react-native/normalize-colors": "0.85.3",
171
+ "@react-native/virtualized-lists": "0.85.3",
172
172
  "abort-controller": "^3.0.0",
173
173
  "anser": "^1.4.9",
174
174
  "ansi-regex": "^5.0.0",
@@ -179,8 +179,8 @@
179
179
  "hermes-compiler": "250829098.0.10",
180
180
  "invariant": "^2.2.4",
181
181
  "memoize-one": "^5.0.0",
182
- "metro-runtime": "^0.84.0",
183
- "metro-source-map": "^0.84.0",
182
+ "metro-runtime": "^0.84.3",
183
+ "metro-source-map": "^0.84.3",
184
184
  "nullthrows": "^1.1.1",
185
185
  "pretty-format": "^29.7.0",
186
186
  "promise": "^8.3.0",
@@ -61,6 +61,7 @@ class ReactNativePodsUtils
61
61
  self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED=1", "React-jsinspectornetwork", :debug)
62
62
  self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED=1", "React-RCTNetwork", :debug)
63
63
  self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED=1", "React-networking", :debug)
64
+ self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED=1", "React-RuntimeApple", :debug)
64
65
  self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1", "React-jsinspector", :debug)
65
66
  self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1", "React-jsinspectornetwork", :debug)
66
67
  self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1", "React-RCTNetwork", :debug)
@@ -157,6 +157,7 @@ def use_react_native! (
157
157
  pod 'React-microtasksnativemodule', :path => "#{prefix}/ReactCommon/react/nativemodule/microtasks"
158
158
  pod 'React-idlecallbacksnativemodule', :path => "#{prefix}/ReactCommon/react/nativemodule/idlecallbacks"
159
159
  pod 'React-intersectionobservernativemodule', :path => "#{prefix}/ReactCommon/react/nativemodule/intersectionobserver"
160
+ pod 'React-mutationobservernativemodule', :path => "#{prefix}/ReactCommon/react/nativemodule/mutationobserver"
160
161
  pod 'React-webperformancenativemodule', :path => "#{prefix}/ReactCommon/react/nativemodule/webperformance"
161
162
  pod 'React-domnativemodule', :path => "#{prefix}/ReactCommon/react/nativemodule/dom"
162
163
  pod 'React-defaultsnativemodule', :path => "#{prefix}/ReactCommon/react/nativemodule/defaults"