react-native 0.82.0-nightly-20250829-b2d25c873 → 0.82.0-nightly-20250830-d3574313c
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.
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/Timers/JSTimers.js +2 -0
- package/Libraries/Utilities/Appearance.d.ts +3 -5
- package/Libraries/Utilities/Appearance.js +5 -17
- package/React/Base/RCTVersion.m +1 -1
- package/ReactAndroid/api/ReactAndroid.api +9 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/BridgelessDevSupportManager.kt +5 -0
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.kt +70 -18
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/PerfMonitorOverlayViewManager.kt +9 -1
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/TracingState.kt +19 -0
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/TracingStateProvider.kt +12 -0
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/perfmonitor/PerfMonitorInspectorTargetBinding.kt +5 -1
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/perfmonitor/PerfMonitorUpdateListener.kt +5 -1
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +3 -4
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.kt +2 -6
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.kt +23 -14
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImplDevHelper.kt +7 -1
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostInspectorTarget.kt +19 -2
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/PixelUtil.kt +4 -4
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java +1 -4
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.kt +2 -2
- package/ReactAndroid/src/main/jni/react/hermes/reactexecutor/OnLoad.cpp +8 -3
- package/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp +3 -1
- package/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.h +6 -2
- package/ReactAndroid/src/main/jni/react/jni/JavaModuleWrapper.h +9 -3
- package/ReactAndroid/src/main/jni/react/jni/JavaScriptExecutorHolder.h +2 -1
- package/ReactAndroid/src/main/jni/react/jni/JniJSModulesUnbundle.h +3 -1
- package/ReactAndroid/src/main/jni/react/jni/MethodInvoker.cpp +3 -0
- package/ReactAndroid/src/main/jni/react/jni/MethodInvoker.h +8 -3
- package/ReactAndroid/src/main/jni/react/jni/ModuleRegistryBuilder.h +4 -1
- package/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp +3 -0
- package/ReactAndroid/src/main/jni/react/runtime/jni/JReactHostInspectorTarget.cpp +7 -0
- package/ReactAndroid/src/main/jni/react/runtime/jni/JReactHostInspectorTarget.h +13 -0
- package/ReactAndroid/src/main/res/devsupport/values/strings.xml +3 -0
- package/ReactAndroid/src/main/res/views/uimanager/values-am/strings.xml +1 -0
- package/ReactCommon/cxxreact/CxxNativeModule.h +4 -1
- package/ReactCommon/cxxreact/Instance.h +5 -2
- package/ReactCommon/cxxreact/JSExecutor.h +6 -3
- package/ReactCommon/cxxreact/JSIndexedRAMBundle.h +3 -1
- package/ReactCommon/cxxreact/JSModulesUnbundle.h +2 -1
- package/ReactCommon/cxxreact/MethodCall.h +3 -1
- package/ReactCommon/cxxreact/ModuleRegistry.h +4 -2
- package/ReactCommon/cxxreact/NativeModule.h +4 -2
- package/ReactCommon/cxxreact/NativeToJsBridge.cpp +3 -1
- package/ReactCommon/cxxreact/NativeToJsBridge.h +2 -1
- package/ReactCommon/cxxreact/RAMBundleRegistry.h +2 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/hermes/executor/HermesExecutorFactory.h +6 -2
- package/ReactCommon/jsi/jsi/jsi.h +1 -1
- package/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h +3 -1
- package/ReactCommon/jsiexecutor/jsireact/JSINativeModules.h +2 -1
- package/ReactCommon/jsinspector-modern/HostTarget.h +6 -0
- package/ReactCommon/jsinspector-modern/HostTargetTracing.cpp +16 -0
- package/ReactCommon/jsinspector-modern/tracing/TracingState.h +24 -0
- package/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.cpp +1 -1
- package/ReactCommon/react/renderer/core/RawValue.h +4 -21
- package/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/HostPlatformColor.h +1 -1
- package/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/PlatformColorParser.h +1 -1
- package/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/HostPlatformColor.h +1 -1
- package/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/HostPlatformColor.h +8 -8
- package/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/HostPlatformColor.mm +11 -11
- package/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/ImageFetcher.cpp +13 -17
- package/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/ImageFetcher.h +2 -1
- package/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/ImageManager.cpp +12 -2
- package/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/ImageRequestParams.h +7 -0
- package/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/conversions.h +31 -12
- package/ReactCommon/react/renderer/mapbuffer/tests/MapBufferTest.cpp +9 -0
- package/ReactCommon/react/runtime/ReactInstance.cpp +3 -0
- package/ReactCommon/reactperflogger/reactperflogger/ReactPerfettoLogger.cpp +5 -0
- package/package.json +8 -8
- package/sdks/hermesc/osx-bin/hermes +0 -0
- package/sdks/hermesc/osx-bin/hermesc +0 -0
- package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
- 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-
|
|
32
|
+
static prerelease: string | null = 'nightly-20250830-d3574313c';
|
|
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
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import {NativeEventSubscription} from '../EventEmitter/RCTNativeAppEventEmitter';
|
|
11
11
|
|
|
12
|
-
type ColorSchemeName = 'light' | 'dark' |
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
100
|
+
NativeAppearance.setColorScheme(colorScheme);
|
|
102
101
|
state.appearance = {
|
|
103
|
-
colorScheme
|
|
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
|
-
}
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -24,7 +24,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
|
|
|
24
24
|
RCTVersionMajor: @(0),
|
|
25
25
|
RCTVersionMinor: @(82),
|
|
26
26
|
RCTVersionPatch: @(0),
|
|
27
|
-
RCTVersionPrerelease: @"nightly-
|
|
27
|
+
RCTVersionPrerelease: @"nightly-20250830-d3574313c",
|
|
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
|
}
|
package/ReactAndroid/src/main/java/com/facebook/react/devsupport/BridgelessDevSupportManager.kt
CHANGED
|
@@ -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
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
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
|
package/ReactAndroid/src/main/java/com/facebook/react/devsupport/PerfMonitorOverlayViewManager.kt
CHANGED
|
@@ -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?.
|
|
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
|
+
}
|
package/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/TracingStateProvider.kt
ADDED
|
@@ -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
|
-
|
|
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
|
|
988
|
-
|
|
989
|
-
|
|
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
|
|
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
|
-
.
|
|
346
|
+
.experimental_prefetchResources(reactContext, params)
|
|
351
347
|
}
|
|
352
348
|
|
|
353
349
|
fun enqueuePendingEvent(
|
|
@@ -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())
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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()
|
|
@@ -16,6 +16,8 @@ import com.facebook.react.bridge.ReactContext
|
|
|
16
16
|
import com.facebook.react.common.annotations.FrameworkAPI
|
|
17
17
|
import com.facebook.react.common.annotations.UnstableReactNativeAPI
|
|
18
18
|
import com.facebook.react.devsupport.ReactInstanceDevHelper
|
|
19
|
+
import com.facebook.react.devsupport.interfaces.TracingState
|
|
20
|
+
import com.facebook.react.devsupport.interfaces.TracingStateProvider
|
|
19
21
|
import com.facebook.react.devsupport.perfmonitor.PerfMonitorDevHelper
|
|
20
22
|
import com.facebook.react.devsupport.perfmonitor.PerfMonitorInspectorTarget
|
|
21
23
|
import com.facebook.react.interfaces.TaskInterface
|
|
@@ -30,7 +32,7 @@ import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
|
30
32
|
@UnstableReactNativeAPI
|
|
31
33
|
@OptIn(FrameworkAPI::class)
|
|
32
34
|
internal class ReactHostImplDevHelper(private val delegate: ReactHostImpl) :
|
|
33
|
-
ReactInstanceDevHelper, PerfMonitorDevHelper {
|
|
35
|
+
ReactInstanceDevHelper, PerfMonitorDevHelper, TracingStateProvider {
|
|
34
36
|
|
|
35
37
|
override val currentActivity: Activity?
|
|
36
38
|
get() = delegate.lastUsedActivity
|
|
@@ -77,4 +79,8 @@ internal class ReactHostImplDevHelper(private val delegate: ReactHostImpl) :
|
|
|
77
79
|
|
|
78
80
|
override fun loadBundle(bundleLoader: JSBundleLoader): TaskInterface<Boolean> =
|
|
79
81
|
delegate.loadBundle(bundleLoader)
|
|
82
|
+
|
|
83
|
+
override fun getTracingState(): TracingState {
|
|
84
|
+
return delegate.reactHostInspectorTarget?.tracingState() ?: TracingState.DISABLED
|
|
85
|
+
}
|
|
80
86
|
}
|
|
@@ -12,6 +12,7 @@ import com.facebook.proguard.annotations.DoNotStripAny
|
|
|
12
12
|
import com.facebook.react.bridge.UiThreadUtil
|
|
13
13
|
import com.facebook.react.common.annotations.FrameworkAPI
|
|
14
14
|
import com.facebook.react.common.annotations.UnstableReactNativeAPI
|
|
15
|
+
import com.facebook.react.devsupport.interfaces.TracingState
|
|
15
16
|
import com.facebook.react.devsupport.perfmonitor.PerfMonitorInspectorTarget
|
|
16
17
|
import com.facebook.react.devsupport.perfmonitor.PerfMonitorUpdateListener
|
|
17
18
|
import com.facebook.soloader.SoLoader
|
|
@@ -40,12 +41,28 @@ internal class ReactHostInspectorTarget(reactHostImpl: ReactHostImpl) :
|
|
|
40
41
|
|
|
41
42
|
external fun stopAndDiscardBackgroundTrace()
|
|
42
43
|
|
|
44
|
+
external fun tracingStateAsInt(): Int
|
|
45
|
+
|
|
46
|
+
fun tracingState(): TracingState {
|
|
47
|
+
return TracingState.entries[tracingStateAsInt()]
|
|
48
|
+
}
|
|
49
|
+
|
|
43
50
|
override fun addPerfMonitorListener(listener: PerfMonitorUpdateListener) {
|
|
44
51
|
perfMonitorListeners.add(listener)
|
|
45
52
|
}
|
|
46
53
|
|
|
47
|
-
override fun
|
|
48
|
-
|
|
54
|
+
override fun pauseAndAnalyzeBackgroundTrace() {
|
|
55
|
+
stopAndStashBackgroundTrace()
|
|
56
|
+
perfMonitorListeners.forEach { listener ->
|
|
57
|
+
listener.onRecordingStateChanged(TracingState.DISABLED)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
override fun resumeBackgroundTrace() {
|
|
62
|
+
startBackgroundTrace()
|
|
63
|
+
perfMonitorListeners.forEach { listener ->
|
|
64
|
+
listener.onRecordingStateChanged(TracingState.ENABLEDINBACKGROUNDMODE)
|
|
65
|
+
}
|
|
49
66
|
}
|
|
50
67
|
|
|
51
68
|
fun handleNativePerfMonitorMetricUpdate(
|
|
@@ -22,7 +22,7 @@ public object PixelUtil {
|
|
|
22
22
|
return TypedValue.applyDimension(
|
|
23
23
|
TypedValue.COMPLEX_UNIT_DIP,
|
|
24
24
|
value,
|
|
25
|
-
DisplayMetricsHolder.
|
|
25
|
+
DisplayMetricsHolder.getScreenDisplayMetrics(),
|
|
26
26
|
)
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -40,7 +40,7 @@ public object PixelUtil {
|
|
|
40
40
|
return Float.NaN
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
val displayMetrics = DisplayMetricsHolder.
|
|
43
|
+
val displayMetrics = DisplayMetricsHolder.getScreenDisplayMetrics()
|
|
44
44
|
val scaledValue = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, value, displayMetrics)
|
|
45
45
|
|
|
46
46
|
if (maxFontScale >= 1) {
|
|
@@ -63,13 +63,13 @@ public object PixelUtil {
|
|
|
63
63
|
return Float.NaN
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
return value / DisplayMetricsHolder.
|
|
66
|
+
return value / DisplayMetricsHolder.getScreenDisplayMetrics().density
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/** @return [Float] that represents the density of the display metrics for device screen. */
|
|
70
70
|
@JvmStatic
|
|
71
71
|
public fun getDisplayMetricDensity(): Float =
|
|
72
|
-
DisplayMetricsHolder.
|
|
72
|
+
DisplayMetricsHolder.getScreenDisplayMetrics().density
|
|
73
73
|
|
|
74
74
|
/* Kotlin extensions */
|
|
75
75
|
public fun Int.dpToPx(): Float = toPixelFromDIP(this.toFloat())
|
|
@@ -488,13 +488,10 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
|
|
|
488
488
|
* ViewManager.
|
|
489
489
|
*
|
|
490
490
|
* @param reactContext {@link com.facebook.react.bridge.ReactContext} used for the view.
|
|
491
|
-
* @param surfaceId {@link int} surface ID
|
|
492
|
-
* @param reactTag reactTag that should be set as ID of the view instance
|
|
493
491
|
* @param params {@link MapBuffer} prefetch request params defined in C++
|
|
494
492
|
*/
|
|
495
493
|
@UnstableReactNativeAPI
|
|
496
|
-
public void
|
|
497
|
-
ReactContext reactContext, int surfaceId, int reactTag, MapBuffer params) {
|
|
494
|
+
public void experimental_prefetchResources(ReactContext reactContext, MapBuffer params) {
|
|
498
495
|
return;
|
|
499
496
|
}
|
|
500
497
|
|
|
@@ -160,7 +160,7 @@ public constructor(reactTextViewManagerCallback: ReactTextViewManagerCallback? =
|
|
|
160
160
|
YogaMeasureOutput.make(layoutWidth, layoutHeight)
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
private val
|
|
163
|
+
private val textBaselineFunction = YogaBaselineFunction { node, width, height ->
|
|
164
164
|
val text =
|
|
165
165
|
checkNotNull(preparedSpannableText) {
|
|
166
166
|
"Spannable element has not been prepared in onBeforeLayout"
|
|
@@ -176,7 +176,7 @@ public constructor(reactTextViewManagerCallback: ReactTextViewManagerCallback? =
|
|
|
176
176
|
private fun initMeasureFunction() {
|
|
177
177
|
if (!isVirtual) {
|
|
178
178
|
setMeasureFunction(textMeasureFunction)
|
|
179
|
-
setBaselineFunction(
|
|
179
|
+
setBaselineFunction(textBaselineFunction)
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
|
|
@@ -44,7 +44,8 @@ static void installBindings(jsi::Runtime& runtime) {
|
|
|
44
44
|
react::bindNativeLogger(runtime, &reactAndroidLoggingHook);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
class
|
|
47
|
+
class [[deprecated(
|
|
48
|
+
"This API will be removed along with the legacy architecture.")]] HermesExecutorHolder
|
|
48
49
|
: public jni::HybridClass<HermesExecutorHolder, JavaScriptExecutorHolder> {
|
|
49
50
|
public:
|
|
50
51
|
static constexpr auto kJavaDescriptor =
|
|
@@ -110,6 +111,10 @@ class HermesExecutorHolder
|
|
|
110
111
|
} // namespace facebook::react
|
|
111
112
|
|
|
112
113
|
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) {
|
|
113
|
-
return facebook::jni::initialize(
|
|
114
|
-
|
|
114
|
+
return facebook::jni::initialize(vm, [] {
|
|
115
|
+
#pragma clang diagnostic push
|
|
116
|
+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
117
|
+
facebook::react::HermesExecutorHolder::registerNatives();
|
|
118
|
+
#pragma clang diagnostic pop
|
|
119
|
+
});
|
|
115
120
|
}
|