react-native 0.83.0-nightly-20250911-dab8a4562 → 0.83.0-nightly-20250913-4fb42c84d
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/Components/Switch/Switch.js +1 -1
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Image/RCTImageBlurUtils.mm +2 -1
- package/Libraries/Image/RCTImageUtils.mm +2 -1
- package/Libraries/Lists/SectionList.d.ts +5 -1
- package/Libraries/NativeAnimation/RCTAnimationUtils.mm +8 -2
- package/React/Base/RCTBridgeModule.h +12 -0
- package/React/Base/RCTVersion.m +1 -1
- package/React/FBReactNativeSpec/FBReactNativeSpecJSI-generated.cpp +6 -0
- package/React/FBReactNativeSpec/FBReactNativeSpecJSI.h +9 -0
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ComponentDescriptors.cpp +0 -1
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ComponentDescriptors.h +0 -1
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ShadowNodes.cpp +0 -1
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ShadowNodes.h +0 -11
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/States.h +0 -2
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm +2 -1
- package/React/Views/RCTBorderDrawing.m +3 -1
- package/React/Views/ScrollView/RCTScrollView.m +2 -1
- package/ReactAndroid/gradle.properties +1 -2
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContextBaseJavaModule.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/perfmonitor/PerfMonitorOverlayManager.kt +1 -7
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/perfmonitor/PerfMonitorOverlayView.kt +46 -179
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/perfmonitor/PerfMonitorUpdateListener.kt +0 -9
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +11 -6
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +7 -1
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +11 -1
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +3 -1
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +3 -1
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +12 -1
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsOverrides_RNOSS_Canary_Android.kt +3 -1
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +3 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoModule.kt +1 -10
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostInspectorTarget.kt +0 -12
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.kt +18 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/CustomStyleSpan.kt +4 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.kt +16 -7
- package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +15 -1
- package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +4 -1
- package/ReactAndroid/src/main/jni/react/runtime/jni/JReactHostInspectorTarget.cpp +0 -11
- package/ReactAndroid/src/main/jni/react/runtime/jni/JReactHostInspectorTarget.h +0 -2
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/jsinspector-modern/HostTarget.cpp +0 -14
- package/ReactCommon/jsinspector-modern/HostTarget.h +0 -16
- package/ReactCommon/jsinspector-modern/InspectorFlags.cpp +0 -7
- package/ReactCommon/jsinspector-modern/InspectorFlags.h +0 -6
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +5 -1
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +6 -1
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +80 -62
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +4 -2
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +5 -1
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +10 -1
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsOverridesOSSCanary.h +5 -1
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +2 -1
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +6 -1
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +3 -1
- package/ReactCommon/react/nativemodule/webperformance/NativePerformance.cpp +0 -9
- package/ReactCommon/react/performance/cdpmetrics/CdpMetricsReporter.cpp +1 -24
- package/ReactCommon/react/performance/cdpmetrics/CdpMetricsReporter.h +0 -1
- package/ReactCommon/react/performance/timeline/PerformanceEntryReporter.cpp +0 -10
- package/ReactCommon/react/performance/timeline/PerformanceEntryReporterListeners.h +0 -2
- package/ReactCommon/react/renderer/animated/AnimatedModule.cpp +1 -1
- package/ReactCommon/react/renderer/animated/NativeAnimatedNodesManager.cpp +32 -2
- package/ReactCommon/react/renderer/animated/NativeAnimatedNodesManager.h +8 -0
- package/ReactCommon/react/renderer/animated/tests/AnimationTestsBase.h +1 -0
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHermesInstance.mm +1 -1
- package/jest/mockComponent.js +3 -2
- package/package.json +8 -8
- package/scripts/codegen/generate-artifacts-executor/generateReactCodegenPodspec.js +5 -0
- package/sdks/hermes-engine/hermes-engine.podspec +6 -1
- package/sdks/hermes-engine/version.properties +1 -0
- 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/src/private/featureflags/ReactNativeFeatureFlags.js +6 -1
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +2 -1
- package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +1 -0
- package/src/private/webapis/performance/Performance.js +7 -7
- package/src/private/webapis/performance/ReactNativeStartupTiming.js +3 -24
- package/ReactCommon/jsinspector-modern/PerfMonitorV2.cpp +0 -92
- package/ReactCommon/jsinspector-modern/PerfMonitorV2.h +0 -59
|
@@ -29,7 +29,7 @@ export default class ReactNativeVersion {
|
|
|
29
29
|
static major: number = 0;
|
|
30
30
|
static minor: number = 83;
|
|
31
31
|
static patch: number = 0;
|
|
32
|
-
static prerelease: string | null = 'nightly-
|
|
32
|
+
static prerelease: string | null = 'nightly-20250913-4fb42c84d';
|
|
33
33
|
|
|
34
34
|
static getVersionString(): string {
|
|
35
35
|
return `${this.major}.${this.minor}.${this.patch}${this.prerelease != null ? `-${this.prerelease}` : ''}`;
|
|
@@ -30,7 +30,8 @@ UIImage *RCTBlurredImageWithRadius(UIImage *inputImage, CGFloat radius)
|
|
|
30
30
|
}].CGImage;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
vImage_Buffer buffer1
|
|
33
|
+
vImage_Buffer buffer1;
|
|
34
|
+
vImage_Buffer buffer2;
|
|
34
35
|
buffer1.width = buffer2.width = CGImageGetWidth(imageRef);
|
|
35
36
|
buffer1.height = buffer2.height = CGImageGetHeight(imageRef);
|
|
36
37
|
buffer1.rowBytes = buffer2.rowBytes = CGImageGetBytesPerRow(imageRef);
|
|
@@ -212,7 +212,8 @@ BOOL RCTUpscalingRequired(
|
|
|
212
212
|
sourceSize.height *= scale;
|
|
213
213
|
|
|
214
214
|
// Calculate aspect ratios if needed (don't bother if resizeMode == stretch)
|
|
215
|
-
CGFloat aspect = 0.0
|
|
215
|
+
CGFloat aspect = 0.0;
|
|
216
|
+
CGFloat targetAspect = 0.0;
|
|
216
217
|
if (resizeMode != RCTResizeModeStretch) {
|
|
217
218
|
aspect = sourceSize.width / sourceSize.height;
|
|
218
219
|
targetAspect = destSize.width / destSize.height;
|
|
@@ -35,7 +35,11 @@ export interface SectionBase<ItemT, SectionT = DefaultSectionT> {
|
|
|
35
35
|
|
|
36
36
|
renderItem?: SectionListRenderItem<ItemT, SectionT> | undefined;
|
|
37
37
|
|
|
38
|
-
ItemSeparatorComponent?:
|
|
38
|
+
ItemSeparatorComponent?:
|
|
39
|
+
| React.ComponentType<any>
|
|
40
|
+
| React.ReactElement
|
|
41
|
+
| null
|
|
42
|
+
| undefined;
|
|
39
43
|
|
|
40
44
|
keyExtractor?: ((item: ItemT, index: number) => string) | undefined;
|
|
41
45
|
}
|
|
@@ -90,9 +90,15 @@ uint32_t RCTInterpolateColorInRange(CGFloat value, NSArray<NSNumber *> *inputRan
|
|
|
90
90
|
CGFloat inputMin = inputRange[rangeIndex].doubleValue;
|
|
91
91
|
CGFloat inputMax = inputRange[rangeIndex + 1].doubleValue;
|
|
92
92
|
|
|
93
|
-
CGFloat redMin
|
|
93
|
+
CGFloat redMin;
|
|
94
|
+
CGFloat greenMin;
|
|
95
|
+
CGFloat blueMin;
|
|
96
|
+
CGFloat alphaMin;
|
|
94
97
|
[outputRange[rangeIndex] getRed:&redMin green:&greenMin blue:&blueMin alpha:&alphaMin];
|
|
95
|
-
CGFloat redMax
|
|
98
|
+
CGFloat redMax;
|
|
99
|
+
CGFloat greenMax;
|
|
100
|
+
CGFloat blueMax;
|
|
101
|
+
CGFloat alphaMax;
|
|
96
102
|
[outputRange[rangeIndex + 1] getRed:&redMax green:&greenMax blue:&blueMax alpha:&alphaMax];
|
|
97
103
|
|
|
98
104
|
return RCTColorFromComponents(
|
|
@@ -69,6 +69,7 @@ RCT_EXTERN_C_END
|
|
|
69
69
|
* will be used as the JS module name. If omitted, the JS module name will
|
|
70
70
|
* match the Objective-C class name.
|
|
71
71
|
*/
|
|
72
|
+
#ifndef RCT_FIT_RM_OLD_RUNTIME
|
|
72
73
|
#define RCT_EXPORT_MODULE(js_name) \
|
|
73
74
|
RCT_EXTERN void RCTRegisterModule(Class); \
|
|
74
75
|
+(NSString *)moduleName \
|
|
@@ -80,6 +81,17 @@ RCT_EXTERN_C_END
|
|
|
80
81
|
RCTRegisterModule(self); \
|
|
81
82
|
}
|
|
82
83
|
|
|
84
|
+
#else
|
|
85
|
+
|
|
86
|
+
#define RCT_EXPORT_MODULE(js_name) \
|
|
87
|
+
RCT_EXTERN void RCTRegisterModule(Class); \
|
|
88
|
+
+(NSString *)moduleName \
|
|
89
|
+
{ \
|
|
90
|
+
return @ #js_name; \
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
#endif // RCT_FIT_RM_OLD_RUNTIME
|
|
94
|
+
|
|
83
95
|
/**
|
|
84
96
|
* Same as RCT_EXPORT_MODULE, but uses __attribute__((constructor)) for module
|
|
85
97
|
* registration. Useful for registering swift classes that forbids use of load
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -24,7 +24,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
|
|
|
24
24
|
RCTVersionMajor: @(0),
|
|
25
25
|
RCTVersionMinor: @(83),
|
|
26
26
|
RCTVersionPatch: @(0),
|
|
27
|
-
RCTVersionPrerelease: @"nightly-
|
|
27
|
+
RCTVersionPrerelease: @"nightly-20250913-4fb42c84d",
|
|
28
28
|
};
|
|
29
29
|
});
|
|
30
30
|
return __rnVersion;
|
|
@@ -137,6 +137,11 @@ static jsi::Value __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_enableA
|
|
|
137
137
|
rt
|
|
138
138
|
);
|
|
139
139
|
}
|
|
140
|
+
static jsi::Value __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_enableAndroidLinearText(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
141
|
+
return static_cast<NativeReactNativeFeatureFlagsCxxSpecJSI *>(&turboModule)->enableAndroidLinearText(
|
|
142
|
+
rt
|
|
143
|
+
);
|
|
144
|
+
}
|
|
140
145
|
static jsi::Value __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_enableAndroidTextMeasurementOptimizations(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
141
146
|
return static_cast<NativeReactNativeFeatureFlagsCxxSpecJSI *>(&turboModule)->enableAndroidTextMeasurementOptimizations(
|
|
142
147
|
rt
|
|
@@ -456,6 +461,7 @@ NativeReactNativeFeatureFlagsCxxSpecJSI::NativeReactNativeFeatureFlagsCxxSpecJSI
|
|
|
456
461
|
methodMap_["disableTextLayoutManagerCacheAndroid"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_disableTextLayoutManagerCacheAndroid};
|
|
457
462
|
methodMap_["enableAccessibilityOrder"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_enableAccessibilityOrder};
|
|
458
463
|
methodMap_["enableAccumulatedUpdatesInRawPropsAndroid"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_enableAccumulatedUpdatesInRawPropsAndroid};
|
|
464
|
+
methodMap_["enableAndroidLinearText"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_enableAndroidLinearText};
|
|
459
465
|
methodMap_["enableAndroidTextMeasurementOptimizations"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_enableAndroidTextMeasurementOptimizations};
|
|
460
466
|
methodMap_["enableBridgelessArchitecture"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_enableBridgelessArchitecture};
|
|
461
467
|
methodMap_["enableCppPropsIteratorSetter"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_enableCppPropsIteratorSetter};
|
|
@@ -337,6 +337,7 @@ public:
|
|
|
337
337
|
virtual bool disableTextLayoutManagerCacheAndroid(jsi::Runtime &rt) = 0;
|
|
338
338
|
virtual bool enableAccessibilityOrder(jsi::Runtime &rt) = 0;
|
|
339
339
|
virtual bool enableAccumulatedUpdatesInRawPropsAndroid(jsi::Runtime &rt) = 0;
|
|
340
|
+
virtual bool enableAndroidLinearText(jsi::Runtime &rt) = 0;
|
|
340
341
|
virtual bool enableAndroidTextMeasurementOptimizations(jsi::Runtime &rt) = 0;
|
|
341
342
|
virtual bool enableBridgelessArchitecture(jsi::Runtime &rt) = 0;
|
|
342
343
|
virtual bool enableCppPropsIteratorSetter(jsi::Runtime &rt) = 0;
|
|
@@ -516,6 +517,14 @@ private:
|
|
|
516
517
|
return bridging::callFromJs<bool>(
|
|
517
518
|
rt, &T::enableAccumulatedUpdatesInRawPropsAndroid, jsInvoker_, instance_);
|
|
518
519
|
}
|
|
520
|
+
bool enableAndroidLinearText(jsi::Runtime &rt) override {
|
|
521
|
+
static_assert(
|
|
522
|
+
bridging::getParameterCount(&T::enableAndroidLinearText) == 1,
|
|
523
|
+
"Expected enableAndroidLinearText(...) to have 1 parameters");
|
|
524
|
+
|
|
525
|
+
return bridging::callFromJs<bool>(
|
|
526
|
+
rt, &T::enableAndroidLinearText, jsInvoker_, instance_);
|
|
527
|
+
}
|
|
519
528
|
bool enableAndroidTextMeasurementOptimizations(jsi::Runtime &rt) override {
|
|
520
529
|
static_assert(
|
|
521
530
|
bridging::getParameterCount(&T::enableAndroidTextMeasurementOptimizations) == 1,
|
package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ComponentDescriptors.cpp
CHANGED
|
@@ -21,7 +21,6 @@ registry->add(concreteComponentDescriptorProvider<AndroidDrawerLayoutComponentDe
|
|
|
21
21
|
registry->add(concreteComponentDescriptorProvider<AndroidSwipeRefreshLayoutComponentDescriptor>());
|
|
22
22
|
registry->add(concreteComponentDescriptorProvider<DebuggingOverlayComponentDescriptor>());
|
|
23
23
|
registry->add(concreteComponentDescriptorProvider<PullToRefreshViewComponentDescriptor>());
|
|
24
|
-
registry->add(concreteComponentDescriptorProvider<SwitchComponentDescriptor>());
|
|
25
24
|
registry->add(concreteComponentDescriptorProvider<UnimplementedNativeViewComponentDescriptor>());
|
|
26
25
|
}
|
|
27
26
|
|
package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ComponentDescriptors.h
CHANGED
|
@@ -21,7 +21,6 @@ using AndroidDrawerLayoutComponentDescriptor = ConcreteComponentDescriptor<Andro
|
|
|
21
21
|
using AndroidSwipeRefreshLayoutComponentDescriptor = ConcreteComponentDescriptor<AndroidSwipeRefreshLayoutShadowNode>;
|
|
22
22
|
using DebuggingOverlayComponentDescriptor = ConcreteComponentDescriptor<DebuggingOverlayShadowNode>;
|
|
23
23
|
using PullToRefreshViewComponentDescriptor = ConcreteComponentDescriptor<PullToRefreshViewShadowNode>;
|
|
24
|
-
using SwitchComponentDescriptor = ConcreteComponentDescriptor<SwitchShadowNode>;
|
|
25
24
|
using UnimplementedNativeViewComponentDescriptor = ConcreteComponentDescriptor<UnimplementedNativeViewShadowNode>;
|
|
26
25
|
|
|
27
26
|
void FBReactNativeSpec_registerComponentDescriptorsFromCodegen(
|
|
@@ -17,7 +17,6 @@ extern const char AndroidDrawerLayoutComponentName[] = "AndroidDrawerLayout";
|
|
|
17
17
|
extern const char AndroidSwipeRefreshLayoutComponentName[] = "AndroidSwipeRefreshLayout";
|
|
18
18
|
extern const char DebuggingOverlayComponentName[] = "DebuggingOverlay";
|
|
19
19
|
extern const char PullToRefreshViewComponentName[] = "PullToRefreshView";
|
|
20
|
-
extern const char SwitchComponentName[] = "Switch";
|
|
21
20
|
extern const char UnimplementedNativeViewComponentName[] = "UnimplementedNativeView";
|
|
22
21
|
|
|
23
22
|
} // namespace facebook::react
|
|
@@ -73,17 +73,6 @@ using PullToRefreshViewShadowNode = ConcreteViewShadowNode<
|
|
|
73
73
|
PullToRefreshViewEventEmitter,
|
|
74
74
|
PullToRefreshViewState>;
|
|
75
75
|
|
|
76
|
-
JSI_EXPORT extern const char SwitchComponentName[];
|
|
77
|
-
|
|
78
|
-
/*
|
|
79
|
-
* `ShadowNode` for <Switch> component.
|
|
80
|
-
*/
|
|
81
|
-
using SwitchShadowNode = ConcreteViewShadowNode<
|
|
82
|
-
SwitchComponentName,
|
|
83
|
-
SwitchProps,
|
|
84
|
-
SwitchEventEmitter,
|
|
85
|
-
SwitchState>;
|
|
86
|
-
|
|
87
76
|
JSI_EXPORT extern const char UnimplementedNativeViewComponentName[];
|
|
88
77
|
|
|
89
78
|
/*
|
|
@@ -80,7 +80,9 @@ static void RCTPathAddEllipticArc(
|
|
|
80
80
|
CGFloat endAngle,
|
|
81
81
|
BOOL clockwise)
|
|
82
82
|
{
|
|
83
|
-
CGFloat xScale = 1
|
|
83
|
+
CGFloat xScale = 1;
|
|
84
|
+
CGFloat yScale = 1;
|
|
85
|
+
CGFloat radius = 0;
|
|
84
86
|
if (size.width != 0) {
|
|
85
87
|
xScale = 1;
|
|
86
88
|
yScale = size.height / size.width;
|
|
@@ -679,7 +679,8 @@ RCT_SCROLL_EVENT_HANDLER(scrollViewDidScrollToTop, onScrollToTop)
|
|
|
679
679
|
return;
|
|
680
680
|
}
|
|
681
681
|
|
|
682
|
-
CGFloat top = 0
|
|
682
|
+
CGFloat top = 0;
|
|
683
|
+
CGFloat left = 0;
|
|
683
684
|
if (contentSize.width < boundsSize.width) {
|
|
684
685
|
left = (boundsSize.width - contentSize.width) * 0.5f;
|
|
685
686
|
}
|
|
@@ -25,7 +25,7 @@ public abstract class ReactContextBaseJavaModule : BaseJavaModule {
|
|
|
25
25
|
* this method whenever you actually need the Activity and make sure to check for `null`.
|
|
26
26
|
*/
|
|
27
27
|
@Deprecated(
|
|
28
|
-
"Deprecated in 0.80.0. Use getReactApplicationContext.getCurrentActivity() instead.",
|
|
28
|
+
"Deprecated in 0.80.0. Use getReactApplicationContext().getCurrentActivity() instead.",
|
|
29
29
|
ReplaceWith("reactApplicationContext.currentActivity"),
|
|
30
30
|
)
|
|
31
31
|
protected fun getCurrentActivity(): Activity? {
|
|
@@ -43,29 +43,23 @@ internal class PerfMonitorOverlayManager(
|
|
|
43
43
|
fun enable() {
|
|
44
44
|
enabled = true
|
|
45
45
|
init()
|
|
46
|
-
UiThreadUtil.runOnUiThread { view?.show() }
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
/** Disable the Perf Monitor overlay. Will remain hidden when updates are received. */
|
|
50
49
|
fun disable() {
|
|
51
50
|
UiThreadUtil.runOnUiThread { view?.hide() }
|
|
51
|
+
view = null
|
|
52
52
|
enabled = false
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
/** Reset the Perf Monitor overlay, e.g. after a reload. */
|
|
56
56
|
fun reset() {
|
|
57
|
-
UiThreadUtil.runOnUiThread { view?.resetState() }
|
|
58
|
-
|
|
59
57
|
// Update with current recording state
|
|
60
58
|
onRecordingStateChanged(
|
|
61
59
|
devHelper.inspectorTarget?.getTracingState() ?: TracingState.ENABLEDINCDPMODE
|
|
62
60
|
)
|
|
63
61
|
}
|
|
64
62
|
|
|
65
|
-
override fun onNewFocusedEvent(data: PerfMonitorUpdateListener.LongTaskEventData) {
|
|
66
|
-
view?.updateFocusedEvent(data)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
63
|
override fun onRecordingStateChanged(state: TracingState) {
|
|
70
64
|
tracingState = state
|
|
71
65
|
view?.updateRecordingState(state)
|
|
@@ -13,8 +13,6 @@ import android.graphics.Color
|
|
|
13
13
|
import android.graphics.Typeface
|
|
14
14
|
import android.graphics.drawable.ColorDrawable
|
|
15
15
|
import android.graphics.drawable.GradientDrawable
|
|
16
|
-
import android.os.Handler
|
|
17
|
-
import android.os.Looper
|
|
18
16
|
import android.view.Gravity
|
|
19
17
|
import android.view.Window
|
|
20
18
|
import android.view.WindowManager
|
|
@@ -26,197 +24,89 @@ import com.facebook.react.R
|
|
|
26
24
|
import com.facebook.react.devsupport.interfaces.TracingState
|
|
27
25
|
import com.facebook.react.uimanager.DisplayMetricsHolder
|
|
28
26
|
import com.facebook.react.uimanager.PixelUtil
|
|
29
|
-
import java.util.Locale
|
|
30
27
|
|
|
31
28
|
internal class PerfMonitorOverlayView(
|
|
32
29
|
private val context: Context,
|
|
33
30
|
private val onButtonPress: () -> Unit,
|
|
34
31
|
) {
|
|
35
|
-
private
|
|
36
|
-
private var
|
|
37
|
-
private val metricsDialog: Dialog
|
|
38
|
-
private val toolbarDialog: Dialog
|
|
39
|
-
private val tooltipDialog: Dialog
|
|
40
|
-
private lateinit var buttonLabel: TextView
|
|
41
|
-
private lateinit var recordingStateLabel: TextView
|
|
42
|
-
private lateinit var durationLabel: TextView
|
|
32
|
+
private val dialog: Dialog
|
|
33
|
+
private lateinit var statusLabel: TextView
|
|
43
34
|
private lateinit var tooltipLabel: TextView
|
|
44
|
-
private var
|
|
45
|
-
private var hideAfterTimeoutHandler: Handler? = null
|
|
35
|
+
private lateinit var statusIndicator: TextView
|
|
46
36
|
|
|
47
37
|
init {
|
|
48
38
|
DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(context)
|
|
49
|
-
|
|
50
|
-
metricsDialog = createMetricsDialog()
|
|
51
|
-
toolbarDialog = createToolbarDialog()
|
|
39
|
+
dialog = createToolbarDialog()
|
|
52
40
|
}
|
|
53
41
|
|
|
54
42
|
fun show() {
|
|
55
|
-
|
|
56
|
-
tooltipDialog.show()
|
|
57
|
-
if (hasEventData) {
|
|
58
|
-
toolbarDialog.window?.decorView?.post { updateMetricsDialogPosition() }
|
|
59
|
-
metricsDialog.show()
|
|
60
|
-
}
|
|
61
|
-
hidden = false
|
|
43
|
+
dialog.show()
|
|
62
44
|
}
|
|
63
45
|
|
|
64
46
|
fun hide() {
|
|
65
|
-
|
|
66
|
-
toolbarDialog.hide()
|
|
67
|
-
tooltipDialog.hide()
|
|
68
|
-
hidden = true
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
fun resetState() {
|
|
72
|
-
hasEventData = false
|
|
73
|
-
metricsDialog.hide()
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
fun updateFocusedEvent(data: PerfMonitorUpdateListener.LongTaskEventData) {
|
|
77
|
-
durationLabel.text = String.format(Locale.US, "%d ms", data.durationMs)
|
|
78
|
-
durationLabel.setTextColor(getDurationHighlightColor(data.responsivenessScore))
|
|
79
|
-
hasEventData = true
|
|
80
|
-
ttl = data.ttl
|
|
81
|
-
|
|
82
|
-
hideAfterTimeoutHandler?.removeCallbacksAndMessages(null)
|
|
83
|
-
|
|
84
|
-
if (!hidden) {
|
|
85
|
-
metricsDialog.show()
|
|
86
|
-
|
|
87
|
-
// Schedule hiding metrics overlay after ttl milliseconds
|
|
88
|
-
if (ttl > 0) {
|
|
89
|
-
if (hideAfterTimeoutHandler == null) {
|
|
90
|
-
hideAfterTimeoutHandler = Handler(Looper.getMainLooper())
|
|
91
|
-
}
|
|
92
|
-
hideAfterTimeoutHandler?.postDelayed({ metricsDialog.hide() }, ttl.toLong())
|
|
93
|
-
}
|
|
94
|
-
}
|
|
47
|
+
dialog.hide()
|
|
95
48
|
}
|
|
96
49
|
|
|
97
50
|
fun updateRecordingState(state: TracingState) {
|
|
98
|
-
recordingStateLabel.text =
|
|
99
|
-
when (state) {
|
|
100
|
-
TracingState.ENABLEDINBACKGROUNDMODE -> "Profiling: ON"
|
|
101
|
-
TracingState.DISABLED -> "Profiling: OFF"
|
|
102
|
-
TracingState.ENABLEDINCDPMODE -> "Profiling: DISABLED"
|
|
103
|
-
}
|
|
104
|
-
buttonLabel.text =
|
|
105
|
-
when (state) {
|
|
106
|
-
TracingState.ENABLEDINBACKGROUNDMODE -> "Open ↗️"
|
|
107
|
-
TracingState.DISABLED -> "Start"
|
|
108
|
-
TracingState.ENABLEDINCDPMODE -> ""
|
|
109
|
-
}
|
|
110
|
-
tooltipLabel.text =
|
|
111
|
-
when (state) {
|
|
112
|
-
TracingState.ENABLEDINBACKGROUNDMODE -> "Dev Menu > Finish performance trace"
|
|
113
|
-
TracingState.DISABLED -> "Dev Menu > Start performance trace"
|
|
114
|
-
TracingState.ENABLEDINCDPMODE -> ""
|
|
115
|
-
}
|
|
116
51
|
if (state == TracingState.ENABLEDINCDPMODE) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
tooltipDialog.show()
|
|
52
|
+
dialog.hide()
|
|
53
|
+
return
|
|
120
54
|
}
|
|
121
55
|
|
|
122
|
-
|
|
56
|
+
if (state == TracingState.ENABLEDINBACKGROUNDMODE) {
|
|
57
|
+
(statusIndicator.background as GradientDrawable).setColor(Color.RED)
|
|
58
|
+
statusLabel.text = "Background Profiling Active"
|
|
59
|
+
tooltipLabel.text = "Press ☰ to open"
|
|
60
|
+
} else {
|
|
61
|
+
(statusIndicator.background as GradientDrawable).setColor(Color.GRAY)
|
|
62
|
+
statusLabel.text = "Background Profiling Stopped"
|
|
63
|
+
tooltipLabel.text = "Press ☰ to restart"
|
|
64
|
+
}
|
|
65
|
+
dialog.show()
|
|
123
66
|
}
|
|
124
67
|
|
|
125
|
-
private fun
|
|
126
|
-
|
|
127
|
-
val longTaskLabel =
|
|
128
|
-
TextView(context).apply {
|
|
129
|
-
textSize = TEXT_SIZE_PRIMARY
|
|
130
|
-
text = "Long Task"
|
|
131
|
-
setTextColor(Color.WHITE)
|
|
132
|
-
typeface = TYPEFACE_BOLD
|
|
133
|
-
}
|
|
134
|
-
durationLabel =
|
|
68
|
+
private fun createToolbarDialog(): Dialog {
|
|
69
|
+
statusIndicator =
|
|
135
70
|
TextView(context).apply {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
71
|
+
width = dpToPx(12f).toInt()
|
|
72
|
+
height = dpToPx(12f).toInt()
|
|
73
|
+
background =
|
|
74
|
+
GradientDrawable().apply {
|
|
75
|
+
shape = GradientDrawable.OVAL
|
|
76
|
+
setColor(Color.RED)
|
|
77
|
+
}
|
|
139
78
|
}
|
|
140
|
-
containerLayout.addView(longTaskLabel)
|
|
141
|
-
containerLayout.addView(durationLabel)
|
|
142
79
|
|
|
143
|
-
val
|
|
144
|
-
|
|
145
|
-
|
|
80
|
+
val textContainer =
|
|
81
|
+
LinearLayout(context).apply {
|
|
82
|
+
orientation = LinearLayout.VERTICAL
|
|
83
|
+
layoutParams =
|
|
84
|
+
LinearLayout.LayoutParams(
|
|
85
|
+
LinearLayout.LayoutParams.WRAP_CONTENT,
|
|
86
|
+
LinearLayout.LayoutParams.WRAP_CONTENT,
|
|
87
|
+
)
|
|
146
88
|
}
|
|
147
|
-
|
|
148
|
-
attributes =
|
|
149
|
-
attributes?.apply {
|
|
150
|
-
flags =
|
|
151
|
-
flags or
|
|
152
|
-
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE or
|
|
153
|
-
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return dialog
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
private fun createToolbarDialog(): Dialog {
|
|
161
|
-
val buttonInner = createInnerLayout()
|
|
162
|
-
recordingStateLabel =
|
|
89
|
+
statusLabel =
|
|
163
90
|
TextView(context).apply {
|
|
164
91
|
textSize = TEXT_SIZE_PRIMARY
|
|
165
92
|
setTextColor(Color.WHITE)
|
|
166
93
|
typeface = TYPEFACE_BOLD
|
|
167
94
|
}
|
|
168
|
-
buttonInner.addView(recordingStateLabel)
|
|
169
|
-
buttonLabel =
|
|
170
|
-
TextView(context).apply {
|
|
171
|
-
textSize = TEXT_SIZE_PRIMARY
|
|
172
|
-
setTextColor(COLOR_TEXT_BLUE)
|
|
173
|
-
typeface = TYPEFACE_BOLD
|
|
174
|
-
}
|
|
175
|
-
buttonInner.addView(buttonLabel)
|
|
176
|
-
val buttonView =
|
|
177
|
-
LinearLayout(context).apply {
|
|
178
|
-
orientation = LinearLayout.VERTICAL
|
|
179
|
-
setPadding(
|
|
180
|
-
dpToPx(8f).toInt(),
|
|
181
|
-
dpToPx(16f).toInt(),
|
|
182
|
-
dpToPx(16f).toInt(),
|
|
183
|
-
dpToPx(8f).toInt(),
|
|
184
|
-
)
|
|
185
|
-
addView(buttonInner)
|
|
186
|
-
setOnClickListener { onButtonPress() }
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
val dialog = createAnchoredDialog(dpToPx(0f), dpToPx(0f)).apply { setContentView(buttonView) }
|
|
190
|
-
dialog.window?.apply {
|
|
191
|
-
attributes =
|
|
192
|
-
attributes?.apply { flags = flags or WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE }
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
return dialog
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
private fun createTooltipDialog(): Dialog {
|
|
199
|
-
val containerLayout = createInnerLayout()
|
|
200
95
|
tooltipLabel =
|
|
201
96
|
TextView(context).apply {
|
|
202
97
|
textSize = TEXT_SIZE_ACCESSORY
|
|
203
98
|
setTextColor(Color.WHITE)
|
|
99
|
+
typeface = TYPEFACE_BOLD
|
|
204
100
|
}
|
|
205
|
-
|
|
101
|
+
textContainer.addView(statusLabel)
|
|
102
|
+
textContainer.addView(tooltipLabel)
|
|
206
103
|
|
|
207
|
-
val
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
attributes?.apply {
|
|
212
|
-
flags =
|
|
213
|
-
flags or
|
|
214
|
-
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE or
|
|
215
|
-
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
|
|
216
|
-
}
|
|
217
|
-
}
|
|
104
|
+
val containerLayout = createInnerLayout()
|
|
105
|
+
containerLayout.setOnClickListener { onButtonPress() }
|
|
106
|
+
containerLayout.addView(statusIndicator)
|
|
107
|
+
containerLayout.addView(textContainer)
|
|
218
108
|
|
|
219
|
-
return
|
|
109
|
+
return createAnchoredDialog(dpToPx(12f), dpToPx(12f)).apply { setContentView(containerLayout) }
|
|
220
110
|
}
|
|
221
111
|
|
|
222
112
|
private fun createAnchoredDialog(offsetX: Float, offsetY: Float): Dialog {
|
|
@@ -278,35 +168,12 @@ internal class PerfMonitorOverlayView(
|
|
|
278
168
|
}
|
|
279
169
|
}
|
|
280
170
|
|
|
281
|
-
private fun getMetricsDialogOffsetX(): Float {
|
|
282
|
-
val toolbarWidth = toolbarDialog?.window?.decorView?.width ?: 0
|
|
283
|
-
return toolbarWidth.toFloat()
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
private fun updateMetricsDialogPosition() {
|
|
287
|
-
metricsDialog?.window?.apply {
|
|
288
|
-
attributes = attributes?.apply { x = getMetricsDialogOffsetX().toInt() }
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
private fun getDurationHighlightColor(responsivenessScore: Int): Int {
|
|
293
|
-
return when (responsivenessScore) {
|
|
294
|
-
2 -> COLOR_TEXT_RED
|
|
295
|
-
1 -> COLOR_TEXT_YELLOW
|
|
296
|
-
else -> COLOR_TEXT_GREEN
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
171
|
private fun dpToPx(dp: Float): Float = PixelUtil.toPixelFromDIP(dp)
|
|
301
172
|
|
|
302
173
|
companion object {
|
|
303
|
-
private val COLOR_TEXT_GREEN = Color.parseColor("#4AEB2F")
|
|
304
|
-
private val COLOR_TEXT_YELLOW = Color.parseColor("#FFAA00")
|
|
305
|
-
private val COLOR_TEXT_RED = Color.parseColor("#FF0000")
|
|
306
|
-
private val COLOR_TEXT_BLUE = Color.parseColor("#00B0FF")
|
|
307
174
|
private val COLOR_OVERLAY_BORDER = Color.parseColor("#6C6C6C")
|
|
308
|
-
private val TEXT_SIZE_PRIMARY =
|
|
309
|
-
private val TEXT_SIZE_ACCESSORY =
|
|
175
|
+
private val TEXT_SIZE_PRIMARY = 12f
|
|
176
|
+
private val TEXT_SIZE_ACCESSORY = 10f
|
|
310
177
|
private val TYPEFACE_BOLD = Typeface.create("sans-serif", Typeface.BOLD)
|
|
311
178
|
}
|
|
312
179
|
}
|
|
@@ -10,15 +10,6 @@ import com.facebook.react.devsupport.interfaces.TracingState
|
|
|
10
10
|
|
|
11
11
|
/** [Experimental] An interface for subscribing to updates for the V2 Perf Monitor. */
|
|
12
12
|
internal interface PerfMonitorUpdateListener {
|
|
13
|
-
data class LongTaskEventData(
|
|
14
|
-
val durationMs: Int,
|
|
15
|
-
val responsivenessScore: Int,
|
|
16
|
-
val ttl: Int,
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
/** Called when a new active performance event should be displayed. */
|
|
20
|
-
fun onNewFocusedEvent(data: LongTaskEventData)
|
|
21
|
-
|
|
22
13
|
/** Called when the recording state of the background performance trace has changed. */
|
|
23
14
|
fun onRecordingStateChanged(state: TracingState)
|
|
24
15
|
}
|
|
@@ -99,7 +99,6 @@ import java.util.HashMap;
|
|
|
99
99
|
import java.util.HashSet;
|
|
100
100
|
import java.util.List;
|
|
101
101
|
import java.util.Map;
|
|
102
|
-
import java.util.Objects;
|
|
103
102
|
import java.util.Queue;
|
|
104
103
|
import java.util.Set;
|
|
105
104
|
import java.util.concurrent.CopyOnWriteArrayList;
|
|
@@ -738,11 +737,17 @@ public class FabricUIManager
|
|
|
738
737
|
* vertical insets.
|
|
739
738
|
*/
|
|
740
739
|
private long getEncodedScreenSizeWithoutVerticalInsets(int surfaceId) {
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
740
|
+
ThemedReactContext context =
|
|
741
|
+
mMountingManager
|
|
742
|
+
.getSurfaceManagerEnforced(surfaceId, "getEncodedScreenSizeWithoutVerticalInsets")
|
|
743
|
+
.getContext();
|
|
744
|
+
if (context == null) {
|
|
745
|
+
FLog.w(TAG, "Couldn't get context from SurfaceMountingManager for surfaceId %d", surfaceId);
|
|
746
|
+
return 0;
|
|
747
|
+
} else {
|
|
748
|
+
return DisplayMetricsHolder.getEncodedScreenSizeWithoutVerticalInsets(
|
|
749
|
+
context.getCurrentActivity());
|
|
750
|
+
}
|
|
746
751
|
}
|
|
747
752
|
|
|
748
753
|
@Override
|
|
@@ -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<<
|
|
7
|
+
* @generated SignedSource<<af10f4eea240ae4a228de9bbc4b78b7e>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -90,6 +90,12 @@ public object ReactNativeFeatureFlags {
|
|
|
90
90
|
@JvmStatic
|
|
91
91
|
public fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean = accessor.enableAccumulatedUpdatesInRawPropsAndroid()
|
|
92
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Enables linear text rendering on Android wherever subpixel text rendering is enabled
|
|
95
|
+
*/
|
|
96
|
+
@JvmStatic
|
|
97
|
+
public fun enableAndroidLinearText(): Boolean = accessor.enableAndroidLinearText()
|
|
98
|
+
|
|
93
99
|
/**
|
|
94
100
|
* Enables various optimizations throughout the path of measuring text on Android.
|
|
95
101
|
*/
|