react-native 0.83.5 → 0.83.7

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 (59) 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/RCTDevLoadingView.mm +17 -0
  5. package/React/CoreModules/RCTJscSafeUrl+Internal.h +23 -0
  6. package/React/CoreModules/RCTJscSafeUrl.mm +38 -0
  7. package/React/CoreModules/RCTRedBox+Internal.h +42 -0
  8. package/React/CoreModules/RCTRedBox.mm +30 -450
  9. package/React/CoreModules/RCTRedBox2AnsiParser+Internal.h +22 -0
  10. package/React/CoreModules/RCTRedBox2AnsiParser.mm +55 -0
  11. package/React/CoreModules/RCTRedBox2Controller+Internal.h +34 -0
  12. package/React/CoreModules/RCTRedBox2Controller.mm +764 -0
  13. package/React/CoreModules/RCTRedBox2ErrorParser+Internal.h +46 -0
  14. package/React/CoreModules/RCTRedBox2ErrorParser.mm +57 -0
  15. package/React/CoreModules/RCTRedBoxController+Internal.h +31 -0
  16. package/React/CoreModules/RCTRedBoxController.mm +447 -0
  17. package/React/CoreModules/RCTRedBoxHMRClient+Internal.h +26 -0
  18. package/React/CoreModules/RCTRedBoxHMRClient.mm +125 -0
  19. package/React/CoreModules/React-CoreModules.podspec +1 -0
  20. package/React/FBReactNativeSpec/FBReactNativeSpecJSI.h +16 -0
  21. package/ReactAndroid/gradle.properties +1 -1
  22. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +13 -1
  23. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +21 -1
  24. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +5 -1
  25. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +5 -1
  26. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +23 -1
  27. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +5 -1
  28. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
  29. package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +29 -1
  30. package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +7 -1
  31. package/ReactCommon/cxxreact/ReactNativeVersion.h +2 -2
  32. package/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp +44 -2
  33. package/ReactCommon/jsinspector-modern/RuntimeAgent.cpp +19 -0
  34. package/ReactCommon/jsinspector-modern/RuntimeAgent.h +7 -0
  35. package/ReactCommon/jsinspector-modern/RuntimeTarget.cpp +33 -0
  36. package/ReactCommon/jsinspector-modern/RuntimeTarget.h +6 -0
  37. package/ReactCommon/react/debug/CMakeLists.txt +2 -1
  38. package/ReactCommon/react/debug/React-debug.podspec +7 -1
  39. package/ReactCommon/react/debug/redbox/AnsiParser.cpp +139 -0
  40. package/ReactCommon/react/debug/redbox/AnsiParser.h +35 -0
  41. package/ReactCommon/react/debug/redbox/JscSafeUrl.cpp +179 -0
  42. package/ReactCommon/react/debug/redbox/JscSafeUrl.h +27 -0
  43. package/ReactCommon/react/debug/redbox/RedBoxErrorParser.cpp +171 -0
  44. package/ReactCommon/react/debug/redbox/RedBoxErrorParser.h +40 -0
  45. package/ReactCommon/react/debug/redbox/tests/AnsiParserTest.cpp +97 -0
  46. package/ReactCommon/react/debug/redbox/tests/JscSafeUrlTest.cpp +173 -0
  47. package/ReactCommon/react/debug/redbox/tests/RedBoxErrorParserTest.cpp +107 -0
  48. package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +9 -1
  49. package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +11 -1
  50. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +58 -22
  51. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +6 -2
  52. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +9 -1
  53. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +19 -1
  54. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +3 -1
  55. package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +11 -1
  56. package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +5 -1
  57. package/package.json +10 -10
  58. package/src/private/featureflags/ReactNativeFeatureFlags.js +11 -1
  59. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +3 -1
@@ -0,0 +1,125 @@
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
+
8
+ #import "RCTRedBoxHMRClient+Internal.h"
9
+
10
+ #if RCT_DEV_MENU
11
+
12
+ @implementation RCTRedBoxHMRClient {
13
+ NSURL *_bundleURL;
14
+ NSURLSessionWebSocketTask *_webSocketTask;
15
+ NSURLSession *_session;
16
+ void (^_onFileChange)(void);
17
+ BOOL _stopped;
18
+ }
19
+
20
+ - (instancetype)initWithBundleURL:(NSURL *)bundleURL onFileChange:(void (^)(void))onFileChange
21
+ {
22
+ if (self = [super init]) {
23
+ _bundleURL = bundleURL;
24
+ _onFileChange = [onFileChange copy];
25
+ }
26
+ return self;
27
+ }
28
+
29
+ - (void)start
30
+ {
31
+ if (![_bundleURL.scheme hasPrefix:@"http"]) {
32
+ return;
33
+ }
34
+
35
+ NSURLComponents *components = [[NSURLComponents alloc] initWithURL:_bundleURL resolvingAgainstBaseURL:NO];
36
+ components.scheme = [_bundleURL.scheme isEqualToString:@"https"] ? @"wss" : @"ws";
37
+ components.path = @"/hot";
38
+ components.query = nil;
39
+ components.fragment = nil;
40
+ NSURL *wsURL = components.URL;
41
+ if (!wsURL) {
42
+ return;
43
+ }
44
+
45
+ _session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]
46
+ delegate:self
47
+ delegateQueue:nil];
48
+ _webSocketTask = [_session webSocketTaskWithURL:wsURL];
49
+ [_webSocketTask resume];
50
+ }
51
+
52
+ - (void)stop
53
+ {
54
+ _stopped = YES;
55
+ _onFileChange = nil;
56
+ [_webSocketTask cancel];
57
+ _webSocketTask = nil;
58
+ [_session invalidateAndCancel];
59
+ _session = nil;
60
+ }
61
+
62
+ - (void)URLSession:(__unused NSURLSession *)session
63
+ webSocketTask:(__unused NSURLSessionWebSocketTask *)webSocketTask
64
+ didOpenWithProtocol:(__unused NSString *)protocol
65
+ {
66
+ NSDictionary *registration = @{
67
+ @"type" : @"register-entrypoints",
68
+ @"entryPoints" : @[ _bundleURL.absoluteString ],
69
+ };
70
+ NSData *json = [NSJSONSerialization dataWithJSONObject:registration options:0 error:nil];
71
+ NSURLSessionWebSocketMessage *msg = [[NSURLSessionWebSocketMessage alloc]
72
+ initWithString:[[NSString alloc] initWithData:json encoding:NSUTF8StringEncoding]];
73
+ [_webSocketTask sendMessage:msg
74
+ completionHandler:^(__unused NSError *error){
75
+ }];
76
+ [self _listenForNextMessage];
77
+ }
78
+
79
+ - (void)_listenForNextMessage
80
+ {
81
+ if (_stopped) {
82
+ return;
83
+ }
84
+ __weak __typeof(self) weakSelf = self;
85
+ [_webSocketTask receiveMessageWithCompletionHandler:^(NSURLSessionWebSocketMessage *message, NSError *error) {
86
+ if (error || !message) {
87
+ return;
88
+ }
89
+ [weakSelf _handleMessage:message];
90
+ [weakSelf _listenForNextMessage];
91
+ }];
92
+ }
93
+
94
+ - (void)_handleMessage:(NSURLSessionWebSocketMessage *)message
95
+ {
96
+ if (message.type != NSURLSessionWebSocketMessageTypeString || _stopped) {
97
+ return;
98
+ }
99
+ NSData *data = [message.string dataUsingEncoding:NSUTF8StringEncoding];
100
+ NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
101
+ if ([json[@"type"] isEqualToString:@"update-start"]) {
102
+ // Ignore the initial update that fires when the client first registers.
103
+ // Only react to subsequent file changes.
104
+ NSDictionary *body = json[@"body"];
105
+ if ([body isKindOfClass:[NSDictionary class]] && [body[@"isInitialUpdate"] boolValue]) {
106
+ return;
107
+ }
108
+ dispatch_async(dispatch_get_main_queue(), ^{
109
+ if (self->_onFileChange) {
110
+ self->_onFileChange();
111
+ }
112
+ });
113
+ }
114
+ }
115
+
116
+ - (void)URLSession:(__unused NSURLSession *)session
117
+ webSocketTask:(__unused NSURLSessionWebSocketTask *)task
118
+ didCloseWithCode:(__unused NSURLSessionWebSocketCloseCode)closeCode
119
+ reason:(__unused NSData *)reason
120
+ {
121
+ }
122
+
123
+ @end
124
+
125
+ #endif
@@ -51,6 +51,7 @@ Pod::Spec.new do |s|
51
51
  s.dependency "React-Core/CoreModulesHeaders", version
52
52
  s.dependency "React-RCTImage", version
53
53
  s.dependency "React-jsi", version
54
+ s.dependency "React-featureflags"
54
55
  s.dependency 'React-RCTBlob'
55
56
  add_dependency(s, "React-debug")
56
57
  add_dependency(s, "React-runtimeexecutor", :additional_framework_paths => ["platform/ios"])
@@ -290,6 +290,8 @@ protected:
290
290
  methodMap_["perfMonitorV2Enabled"] = MethodMetadata {.argCount = 0, .invoker = __perfMonitorV2Enabled};
291
291
  methodMap_["preparedTextCacheSize"] = MethodMetadata {.argCount = 0, .invoker = __preparedTextCacheSize};
292
292
  methodMap_["preventShadowTreeCommitExhaustion"] = MethodMetadata {.argCount = 0, .invoker = __preventShadowTreeCommitExhaustion};
293
+ methodMap_["redBoxV2Android"] = MethodMetadata {.argCount = 0, .invoker = __redBoxV2Android};
294
+ methodMap_["redBoxV2IOS"] = MethodMetadata {.argCount = 0, .invoker = __redBoxV2IOS};
293
295
  methodMap_["shouldPressibilityUseW3CPointerEventsForHover"] = MethodMetadata {.argCount = 0, .invoker = __shouldPressibilityUseW3CPointerEventsForHover};
294
296
  methodMap_["shouldTriggerResponderTransferOnScrollAndroid"] = MethodMetadata {.argCount = 0, .invoker = __shouldTriggerResponderTransferOnScrollAndroid};
295
297
  methodMap_["skipActivityIdentityAssertionOnHostPause"] = MethodMetadata {.argCount = 0, .invoker = __skipActivityIdentityAssertionOnHostPause};
@@ -783,6 +785,20 @@ private:
783
785
  return bridging::callFromJs<bool>(rt, &T::preventShadowTreeCommitExhaustion, static_cast<NativeReactNativeFeatureFlagsCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
784
786
  }
785
787
 
788
+ static jsi::Value __redBoxV2Android(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
789
+ static_assert(
790
+ bridging::getParameterCount(&T::redBoxV2Android) == 1,
791
+ "Expected redBoxV2Android(...) to have 1 parameters");
792
+ return bridging::callFromJs<bool>(rt, &T::redBoxV2Android, static_cast<NativeReactNativeFeatureFlagsCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
793
+ }
794
+
795
+ static jsi::Value __redBoxV2IOS(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
796
+ static_assert(
797
+ bridging::getParameterCount(&T::redBoxV2IOS) == 1,
798
+ "Expected redBoxV2IOS(...) to have 1 parameters");
799
+ return bridging::callFromJs<bool>(rt, &T::redBoxV2IOS, static_cast<NativeReactNativeFeatureFlagsCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
800
+ }
801
+
786
802
  static jsi::Value __shouldPressibilityUseW3CPointerEventsForHover(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
787
803
  static_assert(
788
804
  bridging::getParameterCount(&T::shouldPressibilityUseW3CPointerEventsForHover) == 1,
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.83.5
1
+ VERSION_NAME=0.83.7
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
  react.internal.hermesPublishingGroup=com.facebook.hermes
4
4
 
@@ -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<<a92c35b9527c3954516ee68db651afa7>>
7
+ * @generated SignedSource<<26dfce17f8149372c967e83a1e55b497>>
8
8
  */
9
9
 
10
10
  /**
@@ -426,6 +426,18 @@ public object ReactNativeFeatureFlags {
426
426
  @JvmStatic
427
427
  public fun preventShadowTreeCommitExhaustion(): Boolean = accessor.preventShadowTreeCommitExhaustion()
428
428
 
429
+ /**
430
+ * Use the redesigned RedBox error overlay on Android, styled to match the LogBox visual language.
431
+ */
432
+ @JvmStatic
433
+ public fun redBoxV2Android(): Boolean = accessor.redBoxV2Android()
434
+
435
+ /**
436
+ * Use the redesigned RedBox error overlay on iOS, styled to match the LogBox visual language.
437
+ */
438
+ @JvmStatic
439
+ public fun redBoxV2IOS(): Boolean = accessor.redBoxV2IOS()
440
+
429
441
  /**
430
442
  * Function used to enable / disable Pressibility from using W3C Pointer Events for its hover callbacks
431
443
  */
@@ -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<<a9ec10139cccac681fb73d8155377b02>>
7
+ * @generated SignedSource<<7523b02820a1f77c0a851ed051770f51>>
8
8
  */
9
9
 
10
10
  /**
@@ -86,6 +86,8 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
86
86
  private var perfMonitorV2EnabledCache: Boolean? = null
87
87
  private var preparedTextCacheSizeCache: Double? = null
88
88
  private var preventShadowTreeCommitExhaustionCache: Boolean? = null
89
+ private var redBoxV2AndroidCache: Boolean? = null
90
+ private var redBoxV2IOSCache: Boolean? = null
89
91
  private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
90
92
  private var shouldTriggerResponderTransferOnScrollAndroidCache: Boolean? = null
91
93
  private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
@@ -702,6 +704,24 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
702
704
  return cached
703
705
  }
704
706
 
707
+ override fun redBoxV2Android(): Boolean {
708
+ var cached = redBoxV2AndroidCache
709
+ if (cached == null) {
710
+ cached = ReactNativeFeatureFlagsCxxInterop.redBoxV2Android()
711
+ redBoxV2AndroidCache = cached
712
+ }
713
+ return cached
714
+ }
715
+
716
+ override fun redBoxV2IOS(): Boolean {
717
+ var cached = redBoxV2IOSCache
718
+ if (cached == null) {
719
+ cached = ReactNativeFeatureFlagsCxxInterop.redBoxV2IOS()
720
+ redBoxV2IOSCache = cached
721
+ }
722
+ return cached
723
+ }
724
+
705
725
  override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean {
706
726
  var cached = shouldPressibilityUseW3CPointerEventsForHoverCache
707
727
  if (cached == null) {
@@ -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<<ceb1cf55a1d6b6d71ad27ec7f8594b50>>
7
+ * @generated SignedSource<<0fa0febd40941c466222d1af82f677cf>>
8
8
  */
9
9
 
10
10
  /**
@@ -160,6 +160,10 @@ public object ReactNativeFeatureFlagsCxxInterop {
160
160
 
161
161
  @DoNotStrip @JvmStatic public external fun preventShadowTreeCommitExhaustion(): Boolean
162
162
 
163
+ @DoNotStrip @JvmStatic public external fun redBoxV2Android(): Boolean
164
+
165
+ @DoNotStrip @JvmStatic public external fun redBoxV2IOS(): Boolean
166
+
163
167
  @DoNotStrip @JvmStatic public external fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean
164
168
 
165
169
  @DoNotStrip @JvmStatic public external fun shouldTriggerResponderTransferOnScrollAndroid(): Boolean
@@ -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<<fd1d27cb393bb274b44db0bcec73c7f8>>
7
+ * @generated SignedSource<<9158a8f1750ec5e9e530399fe09f52cf>>
8
8
  */
9
9
 
10
10
  /**
@@ -155,6 +155,10 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
155
155
 
156
156
  override fun preventShadowTreeCommitExhaustion(): Boolean = false
157
157
 
158
+ override fun redBoxV2Android(): Boolean = false
159
+
160
+ override fun redBoxV2IOS(): Boolean = false
161
+
158
162
  override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean = false
159
163
 
160
164
  override fun shouldTriggerResponderTransferOnScrollAndroid(): Boolean = false
@@ -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<<38e86d50298e5c4199d456f709ac13fc>>
7
+ * @generated SignedSource<<9feb91e31a7d54e4b3f7737fb524800b>>
8
8
  */
9
9
 
10
10
  /**
@@ -90,6 +90,8 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
90
90
  private var perfMonitorV2EnabledCache: Boolean? = null
91
91
  private var preparedTextCacheSizeCache: Double? = null
92
92
  private var preventShadowTreeCommitExhaustionCache: Boolean? = null
93
+ private var redBoxV2AndroidCache: Boolean? = null
94
+ private var redBoxV2IOSCache: Boolean? = null
93
95
  private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
94
96
  private var shouldTriggerResponderTransferOnScrollAndroidCache: Boolean? = null
95
97
  private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
@@ -772,6 +774,26 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
772
774
  return cached
773
775
  }
774
776
 
777
+ override fun redBoxV2Android(): Boolean {
778
+ var cached = redBoxV2AndroidCache
779
+ if (cached == null) {
780
+ cached = currentProvider.redBoxV2Android()
781
+ accessedFeatureFlags.add("redBoxV2Android")
782
+ redBoxV2AndroidCache = cached
783
+ }
784
+ return cached
785
+ }
786
+
787
+ override fun redBoxV2IOS(): Boolean {
788
+ var cached = redBoxV2IOSCache
789
+ if (cached == null) {
790
+ cached = currentProvider.redBoxV2IOS()
791
+ accessedFeatureFlags.add("redBoxV2IOS")
792
+ redBoxV2IOSCache = cached
793
+ }
794
+ return cached
795
+ }
796
+
775
797
  override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean {
776
798
  var cached = shouldPressibilityUseW3CPointerEventsForHoverCache
777
799
  if (cached == null) {
@@ -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<<eb09ee29f25cd03df2e7c3d2b3def992>>
7
+ * @generated SignedSource<<5425bfe01cb2aaecc61b65b8c2f7dad0>>
8
8
  */
9
9
 
10
10
  /**
@@ -155,6 +155,10 @@ public interface ReactNativeFeatureFlagsProvider {
155
155
 
156
156
  @DoNotStrip public fun preventShadowTreeCommitExhaustion(): Boolean
157
157
 
158
+ @DoNotStrip public fun redBoxV2Android(): Boolean
159
+
160
+ @DoNotStrip public fun redBoxV2IOS(): Boolean
161
+
158
162
  @DoNotStrip public fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean
159
163
 
160
164
  @DoNotStrip public fun shouldTriggerResponderTransferOnScrollAndroid(): Boolean
@@ -14,7 +14,7 @@ public object ReactNativeVersion {
14
14
  public val VERSION: Map<String, Any?> = mapOf(
15
15
  "major" to 0,
16
16
  "minor" to 83,
17
- "patch" to 5,
17
+ "patch" to 7,
18
18
  "prerelease" to null
19
19
  )
20
20
  }
@@ -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<<d4aa5fd7828c31ac309551066662eeaa>>
7
+ * @generated SignedSource<<986de1b799ad8bc22a323365aef3533b>>
8
8
  */
9
9
 
10
10
  /**
@@ -435,6 +435,18 @@ class ReactNativeFeatureFlagsJavaProvider
435
435
  return method(javaProvider_);
436
436
  }
437
437
 
438
+ bool redBoxV2Android() override {
439
+ static const auto method =
440
+ getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("redBoxV2Android");
441
+ return method(javaProvider_);
442
+ }
443
+
444
+ bool redBoxV2IOS() override {
445
+ static const auto method =
446
+ getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("redBoxV2IOS");
447
+ return method(javaProvider_);
448
+ }
449
+
438
450
  bool shouldPressibilityUseW3CPointerEventsForHover() override {
439
451
  static const auto method =
440
452
  getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("shouldPressibilityUseW3CPointerEventsForHover");
@@ -895,6 +907,16 @@ bool JReactNativeFeatureFlagsCxxInterop::preventShadowTreeCommitExhaustion(
895
907
  return ReactNativeFeatureFlags::preventShadowTreeCommitExhaustion();
896
908
  }
897
909
 
910
+ bool JReactNativeFeatureFlagsCxxInterop::redBoxV2Android(
911
+ facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
912
+ return ReactNativeFeatureFlags::redBoxV2Android();
913
+ }
914
+
915
+ bool JReactNativeFeatureFlagsCxxInterop::redBoxV2IOS(
916
+ facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
917
+ return ReactNativeFeatureFlags::redBoxV2IOS();
918
+ }
919
+
898
920
  bool JReactNativeFeatureFlagsCxxInterop::shouldPressibilityUseW3CPointerEventsForHover(
899
921
  facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
900
922
  return ReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover();
@@ -1229,6 +1251,12 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
1229
1251
  makeNativeMethod(
1230
1252
  "preventShadowTreeCommitExhaustion",
1231
1253
  JReactNativeFeatureFlagsCxxInterop::preventShadowTreeCommitExhaustion),
1254
+ makeNativeMethod(
1255
+ "redBoxV2Android",
1256
+ JReactNativeFeatureFlagsCxxInterop::redBoxV2Android),
1257
+ makeNativeMethod(
1258
+ "redBoxV2IOS",
1259
+ JReactNativeFeatureFlagsCxxInterop::redBoxV2IOS),
1232
1260
  makeNativeMethod(
1233
1261
  "shouldPressibilityUseW3CPointerEventsForHover",
1234
1262
  JReactNativeFeatureFlagsCxxInterop::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<<554bd02cd328ba462d4e703b653d6cdd>>
7
+ * @generated SignedSource<<f5aa0f101192f55b7ac12705d7667424>>
8
8
  */
9
9
 
10
10
  /**
@@ -228,6 +228,12 @@ class JReactNativeFeatureFlagsCxxInterop
228
228
  static bool preventShadowTreeCommitExhaustion(
229
229
  facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
230
230
 
231
+ static bool redBoxV2Android(
232
+ facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
233
+
234
+ static bool redBoxV2IOS(
235
+ facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
236
+
231
237
  static bool shouldPressibilityUseW3CPointerEventsForHover(
232
238
  facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
233
239
 
@@ -14,14 +14,14 @@
14
14
 
15
15
  #define REACT_NATIVE_VERSION_MAJOR 0
16
16
  #define REACT_NATIVE_VERSION_MINOR 83
17
- #define REACT_NATIVE_VERSION_PATCH 5
17
+ #define REACT_NATIVE_VERSION_PATCH 7
18
18
 
19
19
  namespace facebook::react {
20
20
 
21
21
  constexpr struct {
22
22
  int32_t Major = 0;
23
23
  int32_t Minor = 83;
24
- int32_t Patch = 5;
24
+ int32_t Patch = 7;
25
25
  std::string_view Prerelease = "";
26
26
  } ReactNativeVersion;
27
27
 
@@ -8,7 +8,11 @@
8
8
  #include "Registration.h"
9
9
  #include "ConnectionDemux.h"
10
10
 
11
- #if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED)
11
+ #if defined(HERMES_ENABLE_DEBUGGER)
12
+
13
+ #include <hermes/hermes.h>
14
+
15
+ #if !defined(HERMES_V1_ENABLED)
12
16
 
13
17
  namespace facebook::hermes::inspector_modern::chrome {
14
18
 
@@ -34,4 +38,42 @@ void disableDebugging(DebugSessionToken session) {
34
38
 
35
39
  } // namespace facebook::hermes::inspector_modern::chrome
36
40
 
37
- #endif // defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED)
41
+ #else
42
+
43
+ namespace facebook::hermes::inspector_modern {
44
+ class RuntimeAdapter {
45
+ // Backwards compatibility definition fallback for libraries that are compiled
46
+ // without `HERMES_V1_ENABLED` but are linked against React Native with
47
+ // `HERMES_V1_ENABLED` which doesn't provide this symbol.
48
+ public:
49
+ virtual ~RuntimeAdapter() = 0;
50
+ virtual HermesRuntime& getRuntime() = 0;
51
+ virtual void tickleJs();
52
+ };
53
+
54
+ namespace chrome {
55
+
56
+ using DebugSessionToken = int;
57
+
58
+ DebugSessionToken enableDebugging(
59
+ std::unique_ptr<RuntimeAdapter>,
60
+ const std::string&) {
61
+ // Backwards compatibility fallback for libraries that are compiled without
62
+ // `HERMES_V1_ENABLED` but are linked against React Native with
63
+ // `HERMES_V1_ENABLED` which doesn't provide this symbol.
64
+ return -1;
65
+ };
66
+
67
+ void disableDebugging(DebugSessionToken) {
68
+ // Backwards compatibility fallback for libraries that are compiled without
69
+ // `HERMES_V1_ENABLED` but are linked against React Native with
70
+ // `HERMES_V1_ENABLED` which doesn't provide this symbol.
71
+ }
72
+
73
+ } // namespace chrome
74
+
75
+ } // namespace facebook::hermes::inspector_modern
76
+
77
+ #endif // !defined(HERMES_V1_ENABLED)
78
+
79
+ #endif // defined(HERMES_ENABLE_DEBUGGER)
@@ -8,6 +8,10 @@
8
8
  #include "RuntimeAgent.h"
9
9
  #include "SessionState.h"
10
10
 
11
+ #include <folly/dynamic.h>
12
+ #include <jsinspector-modern/cdp/CdpJson.h>
13
+
14
+ #include <chrono>
11
15
  #include <utility>
12
16
 
13
17
  namespace facebook::react::jsinspector_modern {
@@ -119,6 +123,21 @@ void RuntimeAgent::notifyBindingCalled(
119
123
  "name", bindingName)("payload", payload)));
120
124
  }
121
125
 
126
+ void RuntimeAgent::notifyFastRefreshComplete() {
127
+ if (!sessionState_.isReactNativeApplicationDomainEnabled) {
128
+ return;
129
+ }
130
+ folly::dynamic params = folly::dynamic::object(
131
+ "timestamp",
132
+ std::chrono::duration_cast<std::chrono::milliseconds>(
133
+ std::chrono::system_clock::now().time_since_epoch())
134
+ .count());
135
+ frontendChannel_(
136
+ cdp::jsonNotification(
137
+ "ReactNativeApplication.unstable_fastRefreshComplete",
138
+ std::move(params)));
139
+ }
140
+
122
141
  RuntimeAgent::ExportedState RuntimeAgent::getExportedState() {
123
142
  return {
124
143
  .delegateState = delegate_ ? delegate_->getExportedState() : nullptr,
@@ -72,6 +72,13 @@ class RuntimeAgent final {
72
72
 
73
73
  void notifyBindingCalled(const std::string &bindingName, const std::string &payload);
74
74
 
75
+ /**
76
+ * Called by RuntimeTarget when JS calls __notifyFastRefreshComplete().
77
+ * Emits a ReactNativeApplication.unstable_fastRefreshComplete CDP
78
+ * notification if the ReactNativeApplication domain is enabled.
79
+ */
80
+ void notifyFastRefreshComplete();
81
+
75
82
  struct ExportedState {
76
83
  std::unique_ptr<RuntimeAgentDelegate::ExportedState> delegateState;
77
84
  };
@@ -60,6 +60,8 @@ void RuntimeTarget::installGlobals() {
60
60
  // NOTE: RuntimeTarget::installNetworkReporterAPI is in
61
61
  // RuntimeTargetNetwork.cpp
62
62
  installNetworkReporterAPI();
63
+
64
+ installFastRefreshHandler();
63
65
  }
64
66
 
65
67
  std::shared_ptr<RuntimeAgent> RuntimeTarget::createAgent(
@@ -141,6 +143,37 @@ void RuntimeTarget::installBindingHandler(const std::string& bindingName) {
141
143
  });
142
144
  }
143
145
 
146
+ void RuntimeTarget::installFastRefreshHandler() {
147
+ jsExecutor_([selfExecutor = executorFromThis()](jsi::Runtime& runtime) {
148
+ auto globalObj = runtime.global();
149
+ try {
150
+ auto name =
151
+ jsi::PropNameID::forUtf8(runtime, "__notifyFastRefreshComplete");
152
+ globalObj.setProperty(
153
+ runtime,
154
+ name,
155
+ jsi::Function::createFromHostFunction(
156
+ runtime,
157
+ name,
158
+ 0,
159
+ [selfExecutor](
160
+ jsi::Runtime& /*rt*/,
161
+ const jsi::Value&,
162
+ const jsi::Value*,
163
+ size_t) -> jsi::Value {
164
+ selfExecutor([](auto& self) {
165
+ self.agents_.forEach(
166
+ [](auto& agent) { agent.notifyFastRefreshComplete(); });
167
+ });
168
+
169
+ return jsi::Value::undefined();
170
+ }));
171
+ } catch (jsi::JSError&) {
172
+ // Swallow JavaScript exceptions that occur while setting up the global.
173
+ }
174
+ });
175
+ }
176
+
144
177
  void RuntimeTarget::emitDebuggerSessionCreated() {
145
178
  jsExecutor_([selfExecutor = executorFromThis()](jsi::Runtime& runtime) {
146
179
  try {
@@ -289,6 +289,12 @@ class JSINSPECTOR_EXPORT RuntimeTarget : public EnableExecutorFromThis<RuntimeTa
289
289
  */
290
290
  void installGlobals();
291
291
 
292
+ /**
293
+ * Installs __notifyFastRefreshComplete on the runtime's global object.
294
+ * When called from JS, dispatches to all connected RuntimeAgents.
295
+ */
296
+ void installFastRefreshHandler();
297
+
292
298
  /**
293
299
  * Install the console API handler.
294
300
  */
@@ -9,7 +9,8 @@ set(CMAKE_VERBOSE_MAKEFILE on)
9
9
  include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake)
10
10
 
11
11
  file(GLOB react_debug_SRC CONFIGURE_DEPENDS *.cpp)
12
- add_library(react_debug OBJECT ${react_debug_SRC})
12
+ file(GLOB react_debug_redbox_SRC CONFIGURE_DEPENDS redbox/*.cpp)
13
+ add_library(react_debug OBJECT ${react_debug_SRC} ${react_debug_redbox_SRC})
13
14
 
14
15
  target_include_directories(react_debug PUBLIC ${REACT_COMMON_DIR})
15
16
 
@@ -25,10 +25,16 @@ Pod::Spec.new do |s|
25
25
  s.author = "Meta Platforms, Inc. and its affiliates"
26
26
  s.platforms = min_supported_versions
27
27
  s.source = source
28
- s.source_files = podspec_sources("**/*.{cpp,h}", "**/*.h")
28
+ s.source_files = podspec_sources("*.{cpp,h}", "*.h")
29
29
  s.header_dir = "react/debug"
30
30
  s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
31
31
  "DEFINES_MODULE" => "YES" }
32
32
 
33
33
  resolve_use_frameworks(s, header_mappings_dir: "../..", module_name: "React_debug")
34
+
35
+ s.subspec "redbox" do |ss|
36
+ ss.source_files = podspec_sources("redbox/*.{cpp,h}", "redbox/*.h")
37
+ ss.exclude_files = "redbox/tests/**/*.{cpp,h}"
38
+ ss.header_dir = "react/debug/redbox"
39
+ end
34
40
  end