react-native 0.82.0-nightly-20250829-b2d25c873 → 0.82.0-nightly-20250901-544f3b345

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 (88) hide show
  1. package/Libraries/Core/ReactNativeVersion.js +1 -1
  2. package/Libraries/Core/Timers/JSTimers.js +2 -0
  3. package/Libraries/StyleSheet/StyleSheet.d.ts +7 -22
  4. package/Libraries/StyleSheet/StyleSheetExports.js +2 -8
  5. package/Libraries/StyleSheet/StyleSheetExports.js.flow +11 -18
  6. package/Libraries/Utilities/Appearance.d.ts +3 -5
  7. package/Libraries/Utilities/Appearance.js +5 -17
  8. package/React/Base/RCTVersion.m +1 -1
  9. package/ReactAndroid/api/ReactAndroid.api +16 -0
  10. package/ReactAndroid/gradle.properties +1 -1
  11. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/BridgelessDevSupportManager.kt +5 -0
  12. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.kt +70 -18
  13. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/PerfMonitorOverlayViewManager.kt +9 -1
  14. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/TracingState.kt +19 -0
  15. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/TracingStateProvider.kt +12 -0
  16. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/perfmonitor/PerfMonitorInspectorTargetBinding.kt +5 -1
  17. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/perfmonitor/PerfMonitorUpdateListener.kt +5 -1
  18. package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +3 -4
  19. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.kt +2 -6
  20. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
  21. package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.kt +23 -14
  22. package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImplDevHelper.kt +7 -1
  23. package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostInspectorTarget.kt +19 -2
  24. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/PixelUtil.kt +4 -4
  25. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java +1 -4
  26. package/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageResizeMethod.kt +22 -1
  27. package/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageResizeMode.kt +13 -0
  28. package/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.kt +1 -11
  29. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.kt +2 -2
  30. package/ReactAndroid/src/main/jni/react/hermes/reactexecutor/OnLoad.cpp +8 -3
  31. package/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp +3 -1
  32. package/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.h +6 -2
  33. package/ReactAndroid/src/main/jni/react/jni/JavaModuleWrapper.h +9 -3
  34. package/ReactAndroid/src/main/jni/react/jni/JavaScriptExecutorHolder.h +2 -1
  35. package/ReactAndroid/src/main/jni/react/jni/JniJSModulesUnbundle.h +3 -1
  36. package/ReactAndroid/src/main/jni/react/jni/MethodInvoker.cpp +3 -0
  37. package/ReactAndroid/src/main/jni/react/jni/MethodInvoker.h +8 -3
  38. package/ReactAndroid/src/main/jni/react/jni/ModuleRegistryBuilder.h +4 -1
  39. package/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp +3 -0
  40. package/ReactAndroid/src/main/jni/react/runtime/jni/JReactHostInspectorTarget.cpp +7 -0
  41. package/ReactAndroid/src/main/jni/react/runtime/jni/JReactHostInspectorTarget.h +13 -0
  42. package/ReactAndroid/src/main/res/devsupport/values/strings.xml +3 -0
  43. package/ReactAndroid/src/main/res/views/uimanager/values-am/strings.xml +1 -0
  44. package/ReactCommon/cxxreact/CxxNativeModule.h +4 -1
  45. package/ReactCommon/cxxreact/Instance.h +5 -2
  46. package/ReactCommon/cxxreact/JSExecutor.h +6 -3
  47. package/ReactCommon/cxxreact/JSIndexedRAMBundle.h +3 -1
  48. package/ReactCommon/cxxreact/JSModulesUnbundle.h +2 -1
  49. package/ReactCommon/cxxreact/MethodCall.h +3 -1
  50. package/ReactCommon/cxxreact/ModuleRegistry.h +4 -2
  51. package/ReactCommon/cxxreact/NativeModule.h +4 -2
  52. package/ReactCommon/cxxreact/NativeToJsBridge.cpp +3 -1
  53. package/ReactCommon/cxxreact/NativeToJsBridge.h +2 -1
  54. package/ReactCommon/cxxreact/RAMBundleRegistry.h +2 -1
  55. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  56. package/ReactCommon/hermes/executor/HermesExecutorFactory.h +6 -2
  57. package/ReactCommon/jsi/jsi/jsi.h +1 -1
  58. package/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h +3 -1
  59. package/ReactCommon/jsiexecutor/jsireact/JSINativeModules.h +2 -1
  60. package/ReactCommon/jsinspector-modern/HostTarget.h +6 -0
  61. package/ReactCommon/jsinspector-modern/HostTargetTracing.cpp +16 -0
  62. package/ReactCommon/jsinspector-modern/tracing/TracingState.h +24 -0
  63. package/ReactCommon/react/renderer/components/image/ImageShadowNode.cpp +5 -2
  64. package/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewShadowNode.cpp +1 -0
  65. package/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.cpp +1 -1
  66. package/ReactCommon/react/renderer/core/RawValue.h +4 -21
  67. package/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/HostPlatformColor.h +1 -1
  68. package/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/PlatformColorParser.h +1 -1
  69. package/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/HostPlatformColor.h +1 -1
  70. package/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/HostPlatformColor.h +8 -8
  71. package/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/HostPlatformColor.mm +11 -11
  72. package/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/ImageFetcher.cpp +55 -20
  73. package/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/ImageFetcher.h +23 -4
  74. package/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/ImageManager.cpp +12 -2
  75. package/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/ImageRequestParams.h +7 -0
  76. package/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/conversions.h +33 -31
  77. package/ReactCommon/react/renderer/imagemanager/primitives.h +7 -7
  78. package/ReactCommon/react/renderer/mapbuffer/tests/MapBufferTest.cpp +9 -0
  79. package/ReactCommon/react/renderer/scheduler/Scheduler.cpp +33 -0
  80. package/ReactCommon/react/renderer/uimanager/UIManagerCommitHook.h +11 -0
  81. package/ReactCommon/react/runtime/ReactInstance.cpp +3 -0
  82. package/ReactCommon/reactperflogger/reactperflogger/ReactPerfettoLogger.cpp +5 -0
  83. package/package.json +8 -8
  84. package/sdks/hermesc/osx-bin/hermes +0 -0
  85. package/sdks/hermesc/osx-bin/hermesc +0 -0
  86. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  87. package/types_generated/Libraries/StyleSheet/StyleSheetExports.d.ts +11 -19
  88. package/types_generated/Libraries/Utilities/Appearance.d.ts +2 -2
@@ -29,7 +29,7 @@ export default class ReactNativeVersion {
29
29
  static major: number = 0;
30
30
  static minor: number = 82;
31
31
  static patch: number = 0;
32
- static prerelease: string | null = 'nightly-20250829-b2d25c873';
32
+ static prerelease: string | null = 'nightly-20250901-544f3b345';
33
33
 
34
34
  static getVersionString(): string {
35
35
  return `${this.major}.${this.minor}.${this.patch}${this.prerelease != null ? `-${this.prerelease}` : ''}`;
@@ -477,8 +477,10 @@ if (!NativeTiming) {
477
477
  ExportedJSTimers = ({
478
478
  callReactNativeMicrotasks: JSTimers.callReactNativeMicrotasks,
479
479
  queueReactNativeMicrotask: JSTimers.queueReactNativeMicrotask,
480
+ // $FlowFixMe[incompatible-variance]
480
481
  }: typeof JSTimers);
481
482
  } else {
483
+ // $FlowFixMe[incompatible-variance]
482
484
  ExportedJSTimers = JSTimers;
483
485
  }
484
486
 
@@ -17,13 +17,7 @@ export interface StyleSheetProperties {
17
17
  type Falsy = undefined | null | false | '';
18
18
  interface RecursiveArray<T>
19
19
  extends Array<T | ReadonlyArray<T> | RecursiveArray<T>> {}
20
- /** Keep a brand of 'T' so that calls to `StyleSheet.flatten` can take `RegisteredStyle<T>` and return `T`. */
21
- type RegisteredStyle<T> = number & {__registeredStyleBrand: T};
22
- export type StyleProp<T> =
23
- | T
24
- | RegisteredStyle<T>
25
- | RecursiveArray<T | RegisteredStyle<T> | Falsy>
26
- | Falsy;
20
+ export type StyleProp<T> = T | RecursiveArray<T | Falsy> | Falsy;
27
21
 
28
22
  type OpaqueColorValue = symbol & {__TYPE__: 'Color'};
29
23
  export type ColorValue = string | OpaqueColorValue;
@@ -127,24 +121,15 @@ export namespace StyleSheet {
127
121
  bottom: 0;
128
122
  }
129
123
 
130
- /**
131
- * Sometimes you may want `absoluteFill` but with a couple tweaks - `absoluteFillObject` can be
132
- * used to create a customized entry in a `StyleSheet`, e.g.:
133
- *
134
- * const styles = StyleSheet.create({
135
- * wrapper: {
136
- * ...StyleSheet.absoluteFillObject,
137
- * top: 10,
138
- * backgroundColor: 'transparent',
139
- * },
140
- * });
141
- */
142
- export const absoluteFillObject: AbsoluteFillStyle;
143
-
144
124
  /**
145
125
  * A very common pattern is to create overlays with position absolute and zero positioning,
146
126
  * so `absoluteFill` can be used for convenience and to reduce duplication of these repeated
147
127
  * styles.
148
128
  */
149
- export const absoluteFill: RegisteredStyle<AbsoluteFillStyle>;
129
+ export const absoluteFill: AbsoluteFillStyle;
130
+
131
+ /**
132
+ * @deprecated Use `StyleSheet.absoluteFill`.
133
+ */
134
+ export const absoluteFillObject: AbsoluteFillStyle;
150
135
  }
@@ -24,13 +24,7 @@ if (hairlineWidth === 0) {
24
24
  hairlineWidth = 1 / PixelRatio.get();
25
25
  }
26
26
 
27
- const absoluteFill: {
28
- +bottom: 0,
29
- +left: 0,
30
- +position: 'absolute',
31
- +right: 0,
32
- +top: 0,
33
- } = {
27
+ const absoluteFill = {
34
28
  position: 'absolute',
35
29
  left: 0,
36
30
  right: 0,
@@ -108,7 +102,7 @@ export default {
108
102
  * so `absoluteFill` can be used for convenience and to reduce duplication of these repeated
109
103
  * styles.
110
104
  */
111
- absoluteFill: (absoluteFill: any), // TODO: This should be updated after we fix downstream Flow sites.
105
+ absoluteFill,
112
106
 
113
107
  /**
114
108
  * Sometimes you may want `absoluteFill` but with a couple tweaks - `absoluteFillObject` can be
@@ -13,6 +13,14 @@ import type {____Styles_Internal} from './StyleSheetTypes';
13
13
  import composeStyles from '../../src/private/styles/composeStyles';
14
14
  import flattenStyle from './flattenStyle';
15
15
 
16
+ type AbsoluteFillStyle = $ReadOnly<{
17
+ position: 'absolute',
18
+ left: 0,
19
+ right: 0,
20
+ top: 0,
21
+ bottom: 0,
22
+ }>;
23
+
16
24
  /**
17
25
  * This is defined as the width of a thin line on the platform. It can be
18
26
  * used as the thickness of a border or division between two elements.
@@ -37,27 +45,12 @@ declare export const hairlineWidth: number;
37
45
  * so `absoluteFill` can be used for convenience and to reduce duplication of these repeated
38
46
  * styles.
39
47
  */
40
- declare export const absoluteFill: any;
48
+ declare export const absoluteFill: AbsoluteFillStyle;
41
49
 
42
50
  /**
43
- * Sometimes you may want `absoluteFill` but with a couple tweaks - `absoluteFillObject` can be
44
- * used to create a customized entry in a `StyleSheet`, e.g.:
45
- *
46
- * const styles = StyleSheet.create({
47
- * wrapper: {
48
- * ...StyleSheet.absoluteFillObject,
49
- * top: 10,
50
- * backgroundColor: 'transparent',
51
- * },
52
- * });
51
+ * @deprecated Use `StyleSheet.absoluteFill`.
53
52
  */
54
- declare export const absoluteFillObject: {
55
- +bottom: 0,
56
- +left: 0,
57
- +position: 'absolute',
58
- +right: 0,
59
- +top: 0,
60
- };
53
+ declare export const absoluteFillObject: AbsoluteFillStyle;
61
54
 
62
55
  /**
63
56
  * Combines two styles such that style2 will override any styles in style1.
@@ -9,7 +9,7 @@
9
9
 
10
10
  import {NativeEventSubscription} from '../EventEmitter/RCTNativeAppEventEmitter';
11
11
 
12
- type ColorSchemeName = 'light' | 'dark' | null | undefined;
12
+ type ColorSchemeName = 'light' | 'dark' | 'unspecified';
13
13
 
14
14
  export namespace Appearance {
15
15
  type AppearancePreferences = {
@@ -26,7 +26,7 @@ export namespace Appearance {
26
26
  *
27
27
  * Example: `const colorScheme = Appearance.getColorScheme();`
28
28
  */
29
- export function getColorScheme(): ColorSchemeName;
29
+ export function getColorScheme(): ColorSchemeName | null | undefined;
30
30
 
31
31
  /**
32
32
  * Set the color scheme preference. This is useful for overriding the default
@@ -34,9 +34,7 @@ export namespace Appearance {
34
34
  * appearance of the system UI, only the appearance of the app.
35
35
  * Only available on iOS 13+ and Android 10+.
36
36
  */
37
- export function setColorScheme(
38
- scheme: ColorSchemeName | null | undefined,
39
- ): void;
37
+ export function setColorScheme(scheme: ColorSchemeName): void;
40
38
 
41
39
  /**
42
40
  * Add an event handler that is fired when appearance preferences change.
@@ -14,7 +14,6 @@ import typeof INativeAppearance from './NativeAppearance';
14
14
 
15
15
  import NativeEventEmitter from '../EventEmitter/NativeEventEmitter';
16
16
  import EventEmitter from '../vendor/emitter/EventEmitter';
17
- import invariant from 'invariant';
18
17
 
19
18
  export type {AppearancePreferences};
20
19
 
@@ -60,7 +59,7 @@ function getState(): $NonMaybeType<typeof lazyState> {
60
59
  appearanceChanged: [AppearancePreferences],
61
60
  }>(NativeAppearance).addListener('appearanceChanged', newAppearance => {
62
61
  state.appearance = {
63
- colorScheme: toColorScheme(newAppearance.colorScheme),
62
+ colorScheme: newAppearance.colorScheme,
64
63
  };
65
64
  eventEmitter.emit('change', state.appearance);
66
65
  });
@@ -83,7 +82,7 @@ export function getColorScheme(): ?ColorSchemeName {
83
82
  // Lazily initialize `state.appearance`. This should only
84
83
  // happen once because we never reassign a null value to it.
85
84
  state.appearance = {
86
- colorScheme: toColorScheme(NativeAppearance.getColorScheme()),
85
+ colorScheme: NativeAppearance.getColorScheme(),
87
86
  };
88
87
  }
89
88
  colorScheme = state.appearance.colorScheme;
@@ -94,13 +93,13 @@ export function getColorScheme(): ?ColorSchemeName {
94
93
  /**
95
94
  * Updates the current color scheme to the supplied value.
96
95
  */
97
- export function setColorScheme(colorScheme: ?ColorSchemeName): void {
96
+ export function setColorScheme(colorScheme: ColorSchemeName): void {
98
97
  const state = getState();
99
98
  const {NativeAppearance} = state;
100
99
  if (NativeAppearance != null) {
101
- NativeAppearance.setColorScheme(colorScheme ?? 'unspecified');
100
+ NativeAppearance.setColorScheme(colorScheme);
102
101
  state.appearance = {
103
- colorScheme: toColorScheme(NativeAppearance.getColorScheme()),
102
+ colorScheme,
104
103
  };
105
104
  }
106
105
  }
@@ -114,14 +113,3 @@ export function addChangeListener(
114
113
  const {eventEmitter} = getState();
115
114
  return eventEmitter.addListener('change', listener);
116
115
  }
117
-
118
- /**
119
- * TODO: (hramos) T52919652 Use ?ColorSchemeName once codegen supports union
120
- */
121
- function toColorScheme(colorScheme: ?string): ?ColorSchemeName {
122
- invariant(
123
- colorScheme === 'dark' || colorScheme === 'light' || colorScheme == null,
124
- "Unrecognized color scheme. Did you mean 'dark', 'light' or null?",
125
- );
126
- return colorScheme;
127
- }
@@ -24,7 +24,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(82),
26
26
  RCTVersionPatch: @(0),
27
- RCTVersionPrerelease: @"nightly-20250829-b2d25c873",
27
+ RCTVersionPrerelease: @"nightly-20250901-544f3b345",
28
28
  };
29
29
  });
30
30
  return __rnVersion;
@@ -2223,6 +2223,15 @@ public abstract interface class com/facebook/react/devsupport/interfaces/StackFr
2223
2223
  public abstract fun toJSON ()Lorg/json/JSONObject;
2224
2224
  }
2225
2225
 
2226
+ public final class com/facebook/react/devsupport/interfaces/TracingState : java/lang/Enum {
2227
+ public static final field DISABLED Lcom/facebook/react/devsupport/interfaces/TracingState;
2228
+ public static final field ENABLEDINBACKGROUNDMODE Lcom/facebook/react/devsupport/interfaces/TracingState;
2229
+ public static final field ENABLEDINCDPMODE Lcom/facebook/react/devsupport/interfaces/TracingState;
2230
+ public static fun getEntries ()Lkotlin/enums/EnumEntries;
2231
+ public static fun valueOf (Ljava/lang/String;)Lcom/facebook/react/devsupport/interfaces/TracingState;
2232
+ public static fun values ()[Lcom/facebook/react/devsupport/interfaces/TracingState;
2233
+ }
2234
+
2226
2235
  public final class com/facebook/react/fabric/ComponentFactory {
2227
2236
  public fun <init> ()V
2228
2237
  }
@@ -5344,18 +5353,25 @@ public final class com/facebook/react/views/image/ImageLoadEvent$Companion {
5344
5353
 
5345
5354
  public final class com/facebook/react/views/image/ImageResizeMethod : java/lang/Enum {
5346
5355
  public static final field AUTO Lcom/facebook/react/views/image/ImageResizeMethod;
5356
+ public static final field Companion Lcom/facebook/react/views/image/ImageResizeMethod$Companion;
5347
5357
  public static final field NONE Lcom/facebook/react/views/image/ImageResizeMethod;
5348
5358
  public static final field RESIZE Lcom/facebook/react/views/image/ImageResizeMethod;
5349
5359
  public static final field SCALE Lcom/facebook/react/views/image/ImageResizeMethod;
5350
5360
  public static fun getEntries ()Lkotlin/enums/EnumEntries;
5361
+ public static final fun parse (Ljava/lang/String;)Lcom/facebook/react/views/image/ImageResizeMethod;
5351
5362
  public static fun valueOf (Ljava/lang/String;)Lcom/facebook/react/views/image/ImageResizeMethod;
5352
5363
  public static fun values ()[Lcom/facebook/react/views/image/ImageResizeMethod;
5353
5364
  }
5354
5365
 
5366
+ public final class com/facebook/react/views/image/ImageResizeMethod$Companion {
5367
+ public final fun parse (Ljava/lang/String;)Lcom/facebook/react/views/image/ImageResizeMethod;
5368
+ }
5369
+
5355
5370
  public final class com/facebook/react/views/image/ImageResizeMode {
5356
5371
  public static final field INSTANCE Lcom/facebook/react/views/image/ImageResizeMode;
5357
5372
  public static final fun defaultTileMode ()Landroid/graphics/Shader$TileMode;
5358
5373
  public static final fun defaultValue ()Lcom/facebook/drawee/drawable/ScalingUtils$ScaleType;
5374
+ public final synthetic fun fromInt (I)Ljava/lang/String;
5359
5375
  public static final fun toScaleType (Ljava/lang/String;)Lcom/facebook/drawee/drawable/ScalingUtils$ScaleType;
5360
5376
  public static final fun toTileMode (Ljava/lang/String;)Landroid/graphics/Shader$TileMode;
5361
5377
  }
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.82.0-nightly-20250829-b2d25c873
1
+ VERSION_NAME=0.82.0-nightly-20250901-544f3b345
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
 
4
4
  android.useAndroidX=true
@@ -15,6 +15,7 @@ import com.facebook.react.devsupport.interfaces.DevLoadingViewManager
15
15
  import com.facebook.react.devsupport.interfaces.DevSupportManager
16
16
  import com.facebook.react.devsupport.interfaces.PausedInDebuggerOverlayManager
17
17
  import com.facebook.react.devsupport.interfaces.RedBoxHandler
18
+ import com.facebook.react.devsupport.interfaces.TracingState
18
19
  import com.facebook.react.packagerconnection.RequestHandler
19
20
 
20
21
  /**
@@ -80,4 +81,8 @@ internal class BridgelessDevSupportManager(
80
81
  hideRedboxDialog()
81
82
  reactInstanceDevHelper.reload("BridgelessDevSupportManager.handleReloadJS()")
82
83
  }
84
+
85
+ fun tracingState(): TracingState {
86
+ return TracingState.DISABLED
87
+ }
83
88
  }
@@ -52,6 +52,7 @@ import com.facebook.react.devsupport.InspectorFlags.getFuseboxEnabled
52
52
  import com.facebook.react.devsupport.StackTraceHelper.convertJavaStackTrace
53
53
  import com.facebook.react.devsupport.StackTraceHelper.convertJsStackTrace
54
54
  import com.facebook.react.devsupport.interfaces.BundleLoadCallback
55
+ import com.facebook.react.devsupport.interfaces.DebuggerFrontendPanelName
55
56
  import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener
56
57
  import com.facebook.react.devsupport.interfaces.DevLoadingViewManager
57
58
  import com.facebook.react.devsupport.interfaces.DevOptionHandler
@@ -64,6 +65,8 @@ import com.facebook.react.devsupport.interfaces.PackagerStatusCallback
64
65
  import com.facebook.react.devsupport.interfaces.PausedInDebuggerOverlayManager
65
66
  import com.facebook.react.devsupport.interfaces.RedBoxHandler
66
67
  import com.facebook.react.devsupport.interfaces.StackFrame
68
+ import com.facebook.react.devsupport.interfaces.TracingState
69
+ import com.facebook.react.devsupport.interfaces.TracingStateProvider
67
70
  import com.facebook.react.devsupport.perfmonitor.PerfMonitorDevHelper
68
71
  import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
69
72
  import com.facebook.react.internal.featureflags.ReactNativeNewArchitectureFeatureFlags
@@ -180,6 +183,7 @@ public abstract class DevSupportManagerBase(
180
183
  }
181
184
 
182
185
  private var perfMonitorOverlayManager: PerfMonitorOverlayViewManager? = null
186
+ private var tracingStateProvider: TracingStateProvider? = null
183
187
 
184
188
  init {
185
189
  // We store JS bundle loaded from dev server in a single destination in app's data dir.
@@ -358,6 +362,43 @@ public abstract class DevSupportManagerBase(
358
362
  options[debuggerItemString] = DevOptionHandler { this.openDebugger() }
359
363
  }
360
364
 
365
+ if (ReactNativeFeatureFlags.perfMonitorV2Enabled()) {
366
+ val isConnected = isPackagerConnected
367
+ val tracingState = tracingStateProvider?.getTracingState() ?: TracingState.DISABLED
368
+
369
+ val analyzePerformanceItemString =
370
+ when (tracingState) {
371
+ TracingState.ENABLEDINBACKGROUNDMODE ->
372
+ applicationContext.getString(R.string.catalyst_performance_background)
373
+ TracingState.ENABLEDINCDPMODE ->
374
+ applicationContext.getString(R.string.catalyst_performance_cdp)
375
+ TracingState.DISABLED ->
376
+ applicationContext.getString(R.string.catalyst_performance_disabled)
377
+ }
378
+
379
+ if (!isConnected || tracingState == TracingState.ENABLEDINCDPMODE) {
380
+ disabledItemKeys.add(analyzePerformanceItemString)
381
+ }
382
+
383
+ options[analyzePerformanceItemString] =
384
+ when (tracingState) {
385
+ TracingState.ENABLEDINBACKGROUNDMODE ->
386
+ DevOptionHandler {
387
+ UiThreadUtil.runOnUiThread {
388
+ if (reactInstanceDevHelper is PerfMonitorDevHelper)
389
+ reactInstanceDevHelper.inspectorTarget?.pauseAndAnalyzeBackgroundTrace()
390
+ }
391
+ openDebugger(DebuggerFrontendPanelName.PERFORMANCE.toString())
392
+ }
393
+ TracingState.DISABLED ->
394
+ DevOptionHandler {
395
+ if (reactInstanceDevHelper is PerfMonitorDevHelper)
396
+ reactInstanceDevHelper.inspectorTarget?.resumeBackgroundTrace()
397
+ }
398
+ TracingState.ENABLEDINCDPMODE -> DevOptionHandler {}
399
+ }
400
+ }
401
+
361
402
  options[applicationContext.getString(R.string.catalyst_change_bundle_location)] =
362
403
  DevOptionHandler {
363
404
  val context = reactInstanceDevHelper.currentActivity
@@ -409,26 +450,29 @@ public abstract class DevSupportManagerBase(
409
450
  }
410
451
  }
411
452
 
412
- val fpsDebugLabel =
413
- if (devSettings.isFpsDebugEnabled)
414
- applicationContext.getString(R.string.catalyst_perf_monitor_stop)
415
- else applicationContext.getString(R.string.catalyst_perf_monitor)
416
- options[fpsDebugLabel] = DevOptionHandler {
417
- if (!devSettings.isFpsDebugEnabled) {
418
- // Request overlay permission if needed when "Show Perf Monitor" option is selected
419
- val context: Context? = reactInstanceDevHelper.currentActivity
420
- if (context == null) {
421
- FLog.e(ReactConstants.TAG, "Unable to get reference to react activity")
422
- } else {
423
- requestPermission(context)
453
+ // Do not show legacy performance overlay if V2 is enabled
454
+ if (!ReactNativeFeatureFlags.perfMonitorV2Enabled()) {
455
+ val fpsDebugLabel =
456
+ if (devSettings.isFpsDebugEnabled)
457
+ applicationContext.getString(R.string.catalyst_perf_monitor_stop)
458
+ else applicationContext.getString(R.string.catalyst_perf_monitor)
459
+ options[fpsDebugLabel] = DevOptionHandler {
460
+ if (!devSettings.isFpsDebugEnabled) {
461
+ // Request overlay permission if needed when "Show Perf Monitor" option is selected
462
+ val context: Context? = reactInstanceDevHelper.currentActivity
463
+ if (context == null) {
464
+ FLog.e(ReactConstants.TAG, "Unable to get reference to react activity")
465
+ } else {
466
+ requestPermission(context)
467
+ }
424
468
  }
469
+ devSettings.isFpsDebugEnabled = !devSettings.isFpsDebugEnabled
470
+ }
471
+ options[applicationContext.getString(R.string.catalyst_settings)] = DevOptionHandler {
472
+ val intent = Intent(applicationContext, DevSettingsActivity::class.java)
473
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
474
+ applicationContext.startActivity(intent)
425
475
  }
426
- devSettings.isFpsDebugEnabled = !devSettings.isFpsDebugEnabled
427
- }
428
- options[applicationContext.getString(R.string.catalyst_settings)] = DevOptionHandler {
429
- val intent = Intent(applicationContext, DevSettingsActivity::class.java)
430
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
431
- applicationContext.startActivity(intent)
432
476
  }
433
477
 
434
478
  if (customDevOptions.isNotEmpty()) {
@@ -942,6 +986,14 @@ public abstract class DevSupportManagerBase(
942
986
  devSettings.packagerConnectionSettings.setAdditionalOptionForPackager(name, value)
943
987
  }
944
988
 
989
+ /**
990
+ * Sets the background tracing state provider for bridgeless architecture. This is called
991
+ * internally by the ReactHost implementation.
992
+ */
993
+ internal fun setTracingStateProvider(provider: TracingStateProvider?) {
994
+ tracingStateProvider = provider
995
+ }
996
+
945
997
  public companion object {
946
998
  private const val JAVA_ERROR_COOKIE = -1
947
999
  private const val JSEXCEPTION_ERROR_COOKIE = -1
@@ -26,6 +26,7 @@ import androidx.core.view.WindowInsetsCompat
26
26
  import com.facebook.react.R
27
27
  import com.facebook.react.bridge.UiThreadUtil
28
28
  import com.facebook.react.devsupport.interfaces.PerfMonitorOverlayManager
29
+ import com.facebook.react.devsupport.interfaces.TracingState
29
30
  import com.facebook.react.devsupport.perfmonitor.PerfMonitorInspectorTargetBinding
30
31
  import com.facebook.react.devsupport.perfmonitor.PerfMonitorUpdateListener
31
32
  import com.facebook.react.uimanager.DisplayMetricsHolder
@@ -68,6 +69,11 @@ internal class PerfMonitorOverlayViewManager(
68
69
  }
69
70
  }
70
71
 
72
+ override fun onRecordingStateChanged(state: TracingState) {
73
+ // recordingState = state
74
+ // view?.updateRecordingState(state)
75
+ }
76
+
71
77
  override fun onNewFocusedEvent(data: PerfMonitorUpdateListener.LongTaskEventData) {
72
78
  UiThreadUtil.runOnUiThread {
73
79
  ensureInitialized()
@@ -148,6 +154,8 @@ internal class PerfMonitorOverlayViewManager(
148
154
  this.interactionDialog = dialog
149
155
  }
150
156
 
157
+ fun updateRecordingState(state: TracingState) {}
158
+
151
159
  private fun createButton(context: Context) {
152
160
  val buttonInner = createInnerLayout(context)
153
161
  buttonInner.addView(
@@ -177,7 +185,7 @@ internal class PerfMonitorOverlayViewManager(
177
185
  dpToPx(8f).toInt(),
178
186
  )
179
187
  addView(buttonInner)
180
- setOnClickListener { inspectorTarget?.pauseAndAnalyzeTrace() }
188
+ setOnClickListener { inspectorTarget?.pauseAndAnalyzeBackgroundTrace() }
181
189
  }
182
190
  val dialog =
183
191
  createAnchoredDialog(context, dpToPx(0f), dpToPx(0f)).apply { setContentView(buttonView) }
@@ -0,0 +1,19 @@
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
+ package com.facebook.react.devsupport.interfaces
9
+
10
+ import com.facebook.proguard.annotations.DoNotStripAny
11
+
12
+ // Keep in sync with `TracingState.h`
13
+ // JNI wrapper for `jsinspector_modern::Tracing::TracingState`.
14
+ @DoNotStripAny
15
+ public enum class TracingState {
16
+ DISABLED, // There is no active trace
17
+ ENABLEDINBACKGROUNDMODE, // Trace is currently running in background mode
18
+ ENABLEDINCDPMODE, // Trace is currently running in CDP mode
19
+ }
@@ -0,0 +1,12 @@
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
+ package com.facebook.react.devsupport.interfaces
9
+
10
+ internal interface TracingStateProvider {
11
+ fun getTracingState(): TracingState
12
+ }
@@ -12,5 +12,9 @@ package com.facebook.react.devsupport.perfmonitor
12
12
  * exposing actions for the V2 Perf Monitor.
13
13
  */
14
14
  internal interface PerfMonitorInspectorTargetBinding {
15
- public fun pauseAndAnalyzeTrace()
15
+ /** Attempt to pause the current background performance trace, and open in DevTools. */
16
+ public fun pauseAndAnalyzeBackgroundTrace()
17
+
18
+ /** Attempt to start a new background performance trace. */
19
+ public fun resumeBackgroundTrace()
16
20
  }
@@ -4,9 +4,10 @@
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
-
8
7
  package com.facebook.react.devsupport.perfmonitor
9
8
 
9
+ import com.facebook.react.devsupport.interfaces.TracingState
10
+
10
11
  /** [Experimental] An interface for subscribing to updates for the V2 Perf Monitor. */
11
12
  internal interface PerfMonitorUpdateListener {
12
13
  data class LongTaskEventData(
@@ -17,4 +18,7 @@ internal interface PerfMonitorUpdateListener {
17
18
 
18
19
  /** Called when a new active performance event should be displayed. */
19
20
  fun onNewFocusedEvent(data: LongTaskEventData)
21
+
22
+ /** Called when the recording state of the background performance trace has changed. */
23
+ fun onRecordingStateChanged(state: TracingState)
20
24
  }
@@ -984,10 +984,9 @@ public class FabricUIManager
984
984
  * by an ImageView.
985
985
  */
986
986
  @UnstableReactNativeAPI
987
- public void experimental_prefetchResource(
988
- String componentName, int surfaceId, int reactTag, ReadableMapBuffer params) {
989
- mMountingManager.experimental_prefetchResource(
990
- mReactApplicationContext, componentName, surfaceId, reactTag, params);
987
+ public void experimental_prefetchResources(String componentName, ReadableMapBuffer params) {
988
+ mMountingManager.experimental_prefetchResources(
989
+ mReactApplicationContext, componentName, params);
991
990
  }
992
991
 
993
992
  void setBinding(FabricUIManagerBinding binding) {
@@ -331,23 +331,19 @@ internal class MountingManager(
331
331
  *
332
332
  * @param reactContext
333
333
  * @param componentName
334
- * @param surfaceId surface ID
335
- * @param reactTag reactTag that should be set as ID of the view instance
336
334
  * @param params prefetch request params defined in C++
337
335
  */
338
336
  @Suppress("FunctionName")
339
337
  @AnyThread
340
338
  @UnstableReactNativeAPI
341
- fun experimental_prefetchResource(
339
+ fun experimental_prefetchResources(
342
340
  reactContext: ReactContext?,
343
341
  componentName: String?,
344
- surfaceId: Int,
345
- reactTag: Int,
346
342
  params: MapBuffer?,
347
343
  ) {
348
344
  viewManagerRegistry
349
345
  .get(checkNotNull(componentName))
350
- .experimental_prefetchResource(reactContext, surfaceId, reactTag, params)
346
+ .experimental_prefetchResources(reactContext, params)
351
347
  }
352
348
 
353
349
  fun enqueuePendingEvent(
@@ -15,6 +15,6 @@ public object ReactNativeVersion {
15
15
  "major" to 0,
16
16
  "minor" to 82,
17
17
  "patch" to 0,
18
- "prerelease" to "nightly-20250829-b2d25c873"
18
+ "prerelease" to "nightly-20250901-544f3b345"
19
19
  )
20
20
  }
@@ -95,21 +95,30 @@ public class ReactHostImpl(
95
95
  private val useDevSupport: Boolean,
96
96
  devSupportManagerFactory: DevSupportManagerFactory? = null,
97
97
  ) : ReactHost {
98
+ private val reactHostImplDevHelper = ReactHostImplDevHelper(this)
99
+
98
100
  public override val devSupportManager: DevSupportManager =
99
- (devSupportManagerFactory ?: DefaultDevSupportManagerFactory()).create(
100
- applicationContext = context.applicationContext,
101
- reactInstanceManagerHelper = ReactHostImplDevHelper(this),
102
- packagerPathForJSBundleName = reactHostDelegate.jsMainModulePath,
103
- enableOnCreate = true,
104
- redBoxHandler = null,
105
- devBundleDownloadListener = null,
106
- minNumShakes = 2,
107
- customPackagerCommandHandlers = null,
108
- surfaceDelegateFactory = null,
109
- devLoadingViewManager = null,
110
- pausedInDebuggerOverlayManager = null,
111
- useDevSupport = useDevSupport,
112
- )
101
+ (devSupportManagerFactory ?: DefaultDevSupportManagerFactory())
102
+ .create(
103
+ applicationContext = context.applicationContext,
104
+ reactInstanceManagerHelper = reactHostImplDevHelper,
105
+ packagerPathForJSBundleName = reactHostDelegate.jsMainModulePath,
106
+ enableOnCreate = true,
107
+ redBoxHandler = null,
108
+ devBundleDownloadListener = null,
109
+ minNumShakes = 2,
110
+ customPackagerCommandHandlers = null,
111
+ surfaceDelegateFactory = null,
112
+ devLoadingViewManager = null,
113
+ pausedInDebuggerOverlayManager = null,
114
+ useDevSupport = useDevSupport,
115
+ )
116
+ .also { devSupportManager ->
117
+ // Wire up the tracing state provider
118
+ if (devSupportManager is DevSupportManagerBase) {
119
+ devSupportManager.setTracingStateProvider(reactHostImplDevHelper)
120
+ }
121
+ }
113
122
  public override val memoryPressureRouter: MemoryPressureRouter = MemoryPressureRouter(context)
114
123
 
115
124
  private val attachedSurfaces: MutableSet<ReactSurfaceImpl> = HashSet()