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
@@ -28,7 +28,7 @@
28
28
  export default class ReactNativeVersion {
29
29
  static major: number = 0;
30
30
  static minor: number = 83;
31
- static patch: number = 5;
31
+ static patch: number = 7;
32
32
  static prerelease: string | null = null;
33
33
 
34
34
  static getVersionString(): string {
@@ -26,6 +26,7 @@ let hmrUnavailableReason: string | null = null;
26
26
  let hmrOrigin: string | null = null;
27
27
  let currentCompileErrorMessage: string | null = null;
28
28
  let didConnect: boolean = false;
29
+ let lastMarkerChangeId: ?string = null;
29
30
  let pendingLogs: Array<[LogLevel, $ReadOnlyArray<mixed>]> = [];
30
31
 
31
32
  type LogLevel =
@@ -229,10 +230,15 @@ Error: ${e.message}`;
229
230
  }
230
231
  });
231
232
 
232
- client.on('update-done', () => {
233
+ client.on('update-done', body => {
233
234
  pendingUpdatesCount--;
234
235
  if (pendingUpdatesCount === 0) {
235
236
  DevLoadingView.hide();
237
+ const changeId = body?.changeId;
238
+ if (changeId != null && changeId !== lastMarkerChangeId) {
239
+ lastMarkerChangeId = changeId;
240
+ emitFastRefreshCompleteEvents();
241
+ }
236
242
  }
237
243
  });
238
244
 
@@ -378,4 +384,25 @@ function showCompileError() {
378
384
  throw error;
379
385
  }
380
386
 
387
+ function emitFastRefreshCompleteEvents() {
388
+ // Add marker entry in performance timeline
389
+ performance.mark('Fast Refresh - Update done', {
390
+ detail: {
391
+ devtools: {
392
+ dataType: 'marker',
393
+ color: 'primary',
394
+ tooltipText: 'Fast Refresh \u269b',
395
+ },
396
+ },
397
+ });
398
+
399
+ // Notify CDP clients via internal binding
400
+ if (
401
+ // $FlowFixMe[prop-missing] - Injected by RuntimeTarget
402
+ typeof globalThis.__notifyFastRefreshComplete === 'function'
403
+ ) {
404
+ globalThis.__notifyFastRefreshComplete();
405
+ }
406
+ }
407
+
381
408
  export default HMRClient;
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(83),
26
- RCTVersionPatch: @(5),
26
+ RCTVersionPatch: @(7),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -50,10 +50,27 @@ RCT_EXPORT_MODULE()
50
50
  selector:@selector(hide)
51
51
  name:RCTJavaScriptDidFailToLoadNotification
52
52
  object:nil];
53
+ [[NSNotificationCenter defaultCenter] addObserver:self
54
+ selector:@selector(hide)
55
+ name:@"RCTInstanceDidLoadBundle"
56
+ object:nil];
53
57
  }
54
58
  return self;
55
59
  }
56
60
 
61
+ - (void)dealloc
62
+ {
63
+ [self clearInitialMessageDelay];
64
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
65
+ UIWindow *window = _window;
66
+ _window = nil;
67
+ if (window) {
68
+ RCTExecuteOnMainQueue(^{
69
+ window.hidden = YES;
70
+ });
71
+ }
72
+ }
73
+
57
74
  + (void)setEnabled:(BOOL)enabled
58
75
  {
59
76
  RCTDevLoadingViewSetEnabled(enabled);
@@ -0,0 +1,23 @@
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 <Foundation/Foundation.h>
9
+
10
+ /**
11
+ * Converts between standard URLs and JSC-safe URLs.
12
+ *
13
+ * JSC (JavaScriptCore) strips query strings from source URLs in stack traces
14
+ * as of iOS 16.4. Metro works around this by encoding the query string into
15
+ * the URL path. These methods convert between the two formats.
16
+ */
17
+ @interface RCTJscSafeUrl : NSObject
18
+
19
+ + (nonnull NSString *)normalUrlFromJscSafeUrl:(nonnull NSString *)url;
20
+ + (nonnull NSString *)jscSafeUrlFromNormalUrl:(nonnull NSString *)url;
21
+ + (BOOL)isJscSafeUrl:(nonnull NSString *)url;
22
+
23
+ @end
@@ -0,0 +1,38 @@
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 "RCTJscSafeUrl+Internal.h"
9
+
10
+ #import <React/RCTDefines.h>
11
+ #import <react/debug/redbox/JscSafeUrl.h>
12
+
13
+ #if RCT_DEV_MENU
14
+
15
+ using facebook::react::unstable_redbox::isJscSafeUrl;
16
+ using facebook::react::unstable_redbox::toJscSafeUrl;
17
+ using facebook::react::unstable_redbox::toNormalUrl;
18
+
19
+ @implementation RCTJscSafeUrl
20
+
21
+ + (NSString *)normalUrlFromJscSafeUrl:(NSString *)url
22
+ {
23
+ return [NSString stringWithUTF8String:toNormalUrl(url.UTF8String).c_str()];
24
+ }
25
+
26
+ + (NSString *)jscSafeUrlFromNormalUrl:(NSString *)url
27
+ {
28
+ return [NSString stringWithUTF8String:toJscSafeUrl(url.UTF8String).c_str()];
29
+ }
30
+
31
+ + (BOOL)isJscSafeUrl:(NSString *)url
32
+ {
33
+ return isJscSafeUrl(url.UTF8String);
34
+ }
35
+
36
+ @end
37
+
38
+ #endif
@@ -0,0 +1,42 @@
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 <React/RCTDefines.h>
9
+ #import <UIKit/UIKit.h>
10
+
11
+ #if RCT_DEV_MENU
12
+
13
+ @class RCTJSStackFrame;
14
+
15
+ @protocol RCTRedBoxControllerActionDelegate <NSObject>
16
+
17
+ - (void)redBoxController:(UIViewController *)redBoxController openStackFrameInEditor:(RCTJSStackFrame *)stackFrame;
18
+ - (void)reloadFromRedBoxController:(UIViewController *)redBoxController;
19
+ - (void)loadExtraDataViewController;
20
+
21
+ @end
22
+
23
+ @protocol RCTRedBoxControlling <NSObject>
24
+
25
+ @property (nonatomic, weak) id<RCTRedBoxControllerActionDelegate> actionDelegate;
26
+
27
+ - (void)showErrorMessage:(NSString *)message
28
+ withStack:(NSArray<RCTJSStackFrame *> *)stack
29
+ isUpdate:(BOOL)isUpdate
30
+ errorCookie:(int)errorCookie;
31
+
32
+ - (void)dismiss;
33
+
34
+ @end
35
+
36
+ @protocol RCTRedBox2Controlling <RCTRedBoxControlling>
37
+
38
+ @property (nonatomic, strong, nullable) NSURL *bundleURL;
39
+
40
+ @end
41
+
42
+ #endif