react-native 0.82.0-rc.1 → 0.82.0-rc.4

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 (67) hide show
  1. package/Libraries/Components/Switch/Switch.js +1 -1
  2. package/Libraries/Core/ReactNativeVersion.js +1 -1
  3. package/React/Base/RCTVersion.m +1 -1
  4. package/React/FBReactNativeSpec/FBReactNativeSpecJSI-generated.cpp +12 -0
  5. package/React/FBReactNativeSpec/FBReactNativeSpecJSI.h +18 -0
  6. package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ComponentDescriptors.cpp +0 -1
  7. package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ComponentDescriptors.h +0 -1
  8. package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ShadowNodes.cpp +0 -1
  9. package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ShadowNodes.h +0 -11
  10. package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/States.h +0 -2
  11. package/ReactAndroid/gradle.properties +1 -2
  12. package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +10 -0
  13. package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt +18 -8
  14. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +7 -1
  15. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +11 -1
  16. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +3 -1
  17. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +3 -1
  18. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +12 -1
  19. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsOverrides_RNOSS_Canary_Android.kt +3 -1
  20. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +3 -1
  21. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
  22. package/ReactAndroid/src/main/jni/CMakeLists.txt +3 -0
  23. package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +15 -1
  24. package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +4 -1
  25. package/ReactAndroid/src/main/jni/react/hermes/reactexecutor/CMakeLists.txt +1 -1
  26. package/ReactAndroid/src/main/jni/react/runtime/hermes/jni/CMakeLists.txt +1 -1
  27. package/ReactAndroid/src/main/jni/react/runtime/jni/CMakeLists.txt +1 -1
  28. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  29. package/ReactCommon/hermes/executor/CMakeLists.txt +1 -1
  30. package/ReactCommon/hermes/inspector-modern/CMakeLists.txt +1 -1
  31. package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +5 -1
  32. package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +6 -1
  33. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +44 -26
  34. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +4 -2
  35. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +5 -1
  36. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +10 -1
  37. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsOverridesOSSCanary.h +5 -1
  38. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +2 -1
  39. package/ReactCommon/react/nativemodule/defaults/CMakeLists.txt +1 -0
  40. package/ReactCommon/react/nativemodule/defaults/DefaultTurboModules.cpp +8 -0
  41. package/ReactCommon/react/nativemodule/defaults/React-defaultsnativemodule.podspec +1 -0
  42. package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +6 -1
  43. package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +3 -1
  44. package/ReactCommon/react/nativemodule/webperformance/CMakeLists.txt +1 -1
  45. package/ReactCommon/react/nativemodule/webperformance/NativePerformance.cpp +9 -9
  46. package/ReactCommon/react/nativemodule/webperformance/NativePerformance.h +3 -0
  47. package/ReactCommon/react/nativemodule/webperformance/React-webperformancenativemodule.podspec +58 -0
  48. package/ReactCommon/react/runtime/CMakeLists.txt +1 -1
  49. package/ReactCommon/react/runtime/hermes/CMakeLists.txt +1 -1
  50. package/ReactCommon/react/timing/primitives.h +12 -0
  51. package/flow/bom.js.flow +4 -4
  52. package/package.json +9 -8
  53. package/scripts/codegen/generate-artifacts-executor/index.js +0 -5
  54. package/scripts/react_native_pods.rb +1 -0
  55. package/sdks/hermes-engine/hermes-engine.podspec +7 -2
  56. package/sdks/hermes-engine/hermes-utils.rb +2 -2
  57. package/sdks/hermes-engine/version.properties +1 -0
  58. package/sdks/hermesc/osx-bin/hermes +0 -0
  59. package/sdks/hermesc/osx-bin/hermesc +0 -0
  60. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  61. package/settings.gradle.kts +23 -0
  62. package/src/private/featureflags/ReactNativeFeatureFlags.js +6 -1
  63. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +2 -1
  64. package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +1 -0
  65. package/src/private/webapis/performance/Performance.js +26 -7
  66. package/src/private/webapis/performance/ReactNativeStartupTiming.js +3 -24
  67. package/src/private/webapis/performance/specs/NativePerformance.js +2 -0
@@ -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<<3c5588a851e6cdefaba22236c5ebb828>>
7
+ * @generated SignedSource<<bccad78ad6684e7aeb741e3cbf1b8331>>
8
8
  */
9
9
 
10
10
  /**
@@ -821,6 +821,24 @@ bool ReactNativeFeatureFlagsAccessor::enableVirtualViewWindowFocusDetection() {
821
821
  return flagValue.value();
822
822
  }
823
823
 
824
+ bool ReactNativeFeatureFlagsAccessor::enableWebPerformanceAPIsByDefault() {
825
+ auto flagValue = enableWebPerformanceAPIsByDefault_.load();
826
+
827
+ if (!flagValue.has_value()) {
828
+ // This block is not exclusive but it is not necessary.
829
+ // If multiple threads try to initialize the feature flag, we would only
830
+ // be accessing the provider multiple times but the end state of this
831
+ // instance and the returned flag value would be the same.
832
+
833
+ markFlagAsAccessed(44, "enableWebPerformanceAPIsByDefault");
834
+
835
+ flagValue = currentProvider_->enableWebPerformanceAPIsByDefault();
836
+ enableWebPerformanceAPIsByDefault_ = flagValue;
837
+ }
838
+
839
+ return flagValue.value();
840
+ }
841
+
824
842
  bool ReactNativeFeatureFlagsAccessor::fixMappingOfEventPrioritiesBetweenFabricAndReact() {
825
843
  auto flagValue = fixMappingOfEventPrioritiesBetweenFabricAndReact_.load();
826
844
 
@@ -830,7 +848,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMappingOfEventPrioritiesBetweenFabricAn
830
848
  // be accessing the provider multiple times but the end state of this
831
849
  // instance and the returned flag value would be the same.
832
850
 
833
- markFlagAsAccessed(44, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
851
+ markFlagAsAccessed(45, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
834
852
 
835
853
  flagValue = currentProvider_->fixMappingOfEventPrioritiesBetweenFabricAndReact();
836
854
  fixMappingOfEventPrioritiesBetweenFabricAndReact_ = flagValue;
@@ -848,7 +866,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxEnabledRelease() {
848
866
  // be accessing the provider multiple times but the end state of this
849
867
  // instance and the returned flag value would be the same.
850
868
 
851
- markFlagAsAccessed(45, "fuseboxEnabledRelease");
869
+ markFlagAsAccessed(46, "fuseboxEnabledRelease");
852
870
 
853
871
  flagValue = currentProvider_->fuseboxEnabledRelease();
854
872
  fuseboxEnabledRelease_ = flagValue;
@@ -866,7 +884,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxNetworkInspectionEnabled() {
866
884
  // be accessing the provider multiple times but the end state of this
867
885
  // instance and the returned flag value would be the same.
868
886
 
869
- markFlagAsAccessed(46, "fuseboxNetworkInspectionEnabled");
887
+ markFlagAsAccessed(47, "fuseboxNetworkInspectionEnabled");
870
888
 
871
889
  flagValue = currentProvider_->fuseboxNetworkInspectionEnabled();
872
890
  fuseboxNetworkInspectionEnabled_ = flagValue;
@@ -884,7 +902,7 @@ bool ReactNativeFeatureFlagsAccessor::hideOffscreenVirtualViewsOnIOS() {
884
902
  // be accessing the provider multiple times but the end state of this
885
903
  // instance and the returned flag value would be the same.
886
904
 
887
- markFlagAsAccessed(47, "hideOffscreenVirtualViewsOnIOS");
905
+ markFlagAsAccessed(48, "hideOffscreenVirtualViewsOnIOS");
888
906
 
889
907
  flagValue = currentProvider_->hideOffscreenVirtualViewsOnIOS();
890
908
  hideOffscreenVirtualViewsOnIOS_ = flagValue;
@@ -902,7 +920,7 @@ bool ReactNativeFeatureFlagsAccessor::perfMonitorV2Enabled() {
902
920
  // be accessing the provider multiple times but the end state of this
903
921
  // instance and the returned flag value would be the same.
904
922
 
905
- markFlagAsAccessed(48, "perfMonitorV2Enabled");
923
+ markFlagAsAccessed(49, "perfMonitorV2Enabled");
906
924
 
907
925
  flagValue = currentProvider_->perfMonitorV2Enabled();
908
926
  perfMonitorV2Enabled_ = flagValue;
@@ -920,7 +938,7 @@ double ReactNativeFeatureFlagsAccessor::preparedTextCacheSize() {
920
938
  // be accessing the provider multiple times but the end state of this
921
939
  // instance and the returned flag value would be the same.
922
940
 
923
- markFlagAsAccessed(49, "preparedTextCacheSize");
941
+ markFlagAsAccessed(50, "preparedTextCacheSize");
924
942
 
925
943
  flagValue = currentProvider_->preparedTextCacheSize();
926
944
  preparedTextCacheSize_ = flagValue;
@@ -938,7 +956,7 @@ bool ReactNativeFeatureFlagsAccessor::preventShadowTreeCommitExhaustion() {
938
956
  // be accessing the provider multiple times but the end state of this
939
957
  // instance and the returned flag value would be the same.
940
958
 
941
- markFlagAsAccessed(50, "preventShadowTreeCommitExhaustion");
959
+ markFlagAsAccessed(51, "preventShadowTreeCommitExhaustion");
942
960
 
943
961
  flagValue = currentProvider_->preventShadowTreeCommitExhaustion();
944
962
  preventShadowTreeCommitExhaustion_ = flagValue;
@@ -956,7 +974,7 @@ bool ReactNativeFeatureFlagsAccessor::releaseImageDataWhenConsumed() {
956
974
  // be accessing the provider multiple times but the end state of this
957
975
  // instance and the returned flag value would be the same.
958
976
 
959
- markFlagAsAccessed(51, "releaseImageDataWhenConsumed");
977
+ markFlagAsAccessed(52, "releaseImageDataWhenConsumed");
960
978
 
961
979
  flagValue = currentProvider_->releaseImageDataWhenConsumed();
962
980
  releaseImageDataWhenConsumed_ = flagValue;
@@ -974,7 +992,7 @@ bool ReactNativeFeatureFlagsAccessor::shouldPressibilityUseW3CPointerEventsForHo
974
992
  // be accessing the provider multiple times but the end state of this
975
993
  // instance and the returned flag value would be the same.
976
994
 
977
- markFlagAsAccessed(52, "shouldPressibilityUseW3CPointerEventsForHover");
995
+ markFlagAsAccessed(53, "shouldPressibilityUseW3CPointerEventsForHover");
978
996
 
979
997
  flagValue = currentProvider_->shouldPressibilityUseW3CPointerEventsForHover();
980
998
  shouldPressibilityUseW3CPointerEventsForHover_ = flagValue;
@@ -992,7 +1010,7 @@ bool ReactNativeFeatureFlagsAccessor::skipActivityIdentityAssertionOnHostPause()
992
1010
  // be accessing the provider multiple times but the end state of this
993
1011
  // instance and the returned flag value would be the same.
994
1012
 
995
- markFlagAsAccessed(53, "skipActivityIdentityAssertionOnHostPause");
1013
+ markFlagAsAccessed(54, "skipActivityIdentityAssertionOnHostPause");
996
1014
 
997
1015
  flagValue = currentProvider_->skipActivityIdentityAssertionOnHostPause();
998
1016
  skipActivityIdentityAssertionOnHostPause_ = flagValue;
@@ -1010,7 +1028,7 @@ bool ReactNativeFeatureFlagsAccessor::sweepActiveTouchOnChildNativeGesturesAndro
1010
1028
  // be accessing the provider multiple times but the end state of this
1011
1029
  // instance and the returned flag value would be the same.
1012
1030
 
1013
- markFlagAsAccessed(54, "sweepActiveTouchOnChildNativeGesturesAndroid");
1031
+ markFlagAsAccessed(55, "sweepActiveTouchOnChildNativeGesturesAndroid");
1014
1032
 
1015
1033
  flagValue = currentProvider_->sweepActiveTouchOnChildNativeGesturesAndroid();
1016
1034
  sweepActiveTouchOnChildNativeGesturesAndroid_ = flagValue;
@@ -1028,7 +1046,7 @@ bool ReactNativeFeatureFlagsAccessor::traceTurboModulePromiseRejectionsOnAndroid
1028
1046
  // be accessing the provider multiple times but the end state of this
1029
1047
  // instance and the returned flag value would be the same.
1030
1048
 
1031
- markFlagAsAccessed(55, "traceTurboModulePromiseRejectionsOnAndroid");
1049
+ markFlagAsAccessed(56, "traceTurboModulePromiseRejectionsOnAndroid");
1032
1050
 
1033
1051
  flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid();
1034
1052
  traceTurboModulePromiseRejectionsOnAndroid_ = flagValue;
@@ -1046,7 +1064,7 @@ bool ReactNativeFeatureFlagsAccessor::updateRuntimeShadowNodeReferencesOnCommit(
1046
1064
  // be accessing the provider multiple times but the end state of this
1047
1065
  // instance and the returned flag value would be the same.
1048
1066
 
1049
- markFlagAsAccessed(56, "updateRuntimeShadowNodeReferencesOnCommit");
1067
+ markFlagAsAccessed(57, "updateRuntimeShadowNodeReferencesOnCommit");
1050
1068
 
1051
1069
  flagValue = currentProvider_->updateRuntimeShadowNodeReferencesOnCommit();
1052
1070
  updateRuntimeShadowNodeReferencesOnCommit_ = flagValue;
@@ -1064,7 +1082,7 @@ bool ReactNativeFeatureFlagsAccessor::useAlwaysAvailableJSErrorHandling() {
1064
1082
  // be accessing the provider multiple times but the end state of this
1065
1083
  // instance and the returned flag value would be the same.
1066
1084
 
1067
- markFlagAsAccessed(57, "useAlwaysAvailableJSErrorHandling");
1085
+ markFlagAsAccessed(58, "useAlwaysAvailableJSErrorHandling");
1068
1086
 
1069
1087
  flagValue = currentProvider_->useAlwaysAvailableJSErrorHandling();
1070
1088
  useAlwaysAvailableJSErrorHandling_ = flagValue;
@@ -1082,7 +1100,7 @@ bool ReactNativeFeatureFlagsAccessor::useFabricInterop() {
1082
1100
  // be accessing the provider multiple times but the end state of this
1083
1101
  // instance and the returned flag value would be the same.
1084
1102
 
1085
- markFlagAsAccessed(58, "useFabricInterop");
1103
+ markFlagAsAccessed(59, "useFabricInterop");
1086
1104
 
1087
1105
  flagValue = currentProvider_->useFabricInterop();
1088
1106
  useFabricInterop_ = flagValue;
@@ -1100,7 +1118,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeEqualsInNativeReadableArrayAndroi
1100
1118
  // be accessing the provider multiple times but the end state of this
1101
1119
  // instance and the returned flag value would be the same.
1102
1120
 
1103
- markFlagAsAccessed(59, "useNativeEqualsInNativeReadableArrayAndroid");
1121
+ markFlagAsAccessed(60, "useNativeEqualsInNativeReadableArrayAndroid");
1104
1122
 
1105
1123
  flagValue = currentProvider_->useNativeEqualsInNativeReadableArrayAndroid();
1106
1124
  useNativeEqualsInNativeReadableArrayAndroid_ = flagValue;
@@ -1118,7 +1136,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeTransformHelperAndroid() {
1118
1136
  // be accessing the provider multiple times but the end state of this
1119
1137
  // instance and the returned flag value would be the same.
1120
1138
 
1121
- markFlagAsAccessed(60, "useNativeTransformHelperAndroid");
1139
+ markFlagAsAccessed(61, "useNativeTransformHelperAndroid");
1122
1140
 
1123
1141
  flagValue = currentProvider_->useNativeTransformHelperAndroid();
1124
1142
  useNativeTransformHelperAndroid_ = flagValue;
@@ -1136,7 +1154,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeViewConfigsInBridgelessMode() {
1136
1154
  // be accessing the provider multiple times but the end state of this
1137
1155
  // instance and the returned flag value would be the same.
1138
1156
 
1139
- markFlagAsAccessed(61, "useNativeViewConfigsInBridgelessMode");
1157
+ markFlagAsAccessed(62, "useNativeViewConfigsInBridgelessMode");
1140
1158
 
1141
1159
  flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode();
1142
1160
  useNativeViewConfigsInBridgelessMode_ = flagValue;
@@ -1154,7 +1172,7 @@ bool ReactNativeFeatureFlagsAccessor::useOptimizedEventBatchingOnAndroid() {
1154
1172
  // be accessing the provider multiple times but the end state of this
1155
1173
  // instance and the returned flag value would be the same.
1156
1174
 
1157
- markFlagAsAccessed(62, "useOptimizedEventBatchingOnAndroid");
1175
+ markFlagAsAccessed(63, "useOptimizedEventBatchingOnAndroid");
1158
1176
 
1159
1177
  flagValue = currentProvider_->useOptimizedEventBatchingOnAndroid();
1160
1178
  useOptimizedEventBatchingOnAndroid_ = flagValue;
@@ -1172,7 +1190,7 @@ bool ReactNativeFeatureFlagsAccessor::useRawPropsJsiValue() {
1172
1190
  // be accessing the provider multiple times but the end state of this
1173
1191
  // instance and the returned flag value would be the same.
1174
1192
 
1175
- markFlagAsAccessed(63, "useRawPropsJsiValue");
1193
+ markFlagAsAccessed(64, "useRawPropsJsiValue");
1176
1194
 
1177
1195
  flagValue = currentProvider_->useRawPropsJsiValue();
1178
1196
  useRawPropsJsiValue_ = flagValue;
@@ -1190,7 +1208,7 @@ bool ReactNativeFeatureFlagsAccessor::useShadowNodeStateOnClone() {
1190
1208
  // be accessing the provider multiple times but the end state of this
1191
1209
  // instance and the returned flag value would be the same.
1192
1210
 
1193
- markFlagAsAccessed(64, "useShadowNodeStateOnClone");
1211
+ markFlagAsAccessed(65, "useShadowNodeStateOnClone");
1194
1212
 
1195
1213
  flagValue = currentProvider_->useShadowNodeStateOnClone();
1196
1214
  useShadowNodeStateOnClone_ = flagValue;
@@ -1208,7 +1226,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModuleInterop() {
1208
1226
  // be accessing the provider multiple times but the end state of this
1209
1227
  // instance and the returned flag value would be the same.
1210
1228
 
1211
- markFlagAsAccessed(65, "useTurboModuleInterop");
1229
+ markFlagAsAccessed(66, "useTurboModuleInterop");
1212
1230
 
1213
1231
  flagValue = currentProvider_->useTurboModuleInterop();
1214
1232
  useTurboModuleInterop_ = flagValue;
@@ -1226,7 +1244,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModules() {
1226
1244
  // be accessing the provider multiple times but the end state of this
1227
1245
  // instance and the returned flag value would be the same.
1228
1246
 
1229
- markFlagAsAccessed(66, "useTurboModules");
1247
+ markFlagAsAccessed(67, "useTurboModules");
1230
1248
 
1231
1249
  flagValue = currentProvider_->useTurboModules();
1232
1250
  useTurboModules_ = flagValue;
@@ -1244,7 +1262,7 @@ double ReactNativeFeatureFlagsAccessor::virtualViewHysteresisRatio() {
1244
1262
  // be accessing the provider multiple times but the end state of this
1245
1263
  // instance and the returned flag value would be the same.
1246
1264
 
1247
- markFlagAsAccessed(67, "virtualViewHysteresisRatio");
1265
+ markFlagAsAccessed(68, "virtualViewHysteresisRatio");
1248
1266
 
1249
1267
  flagValue = currentProvider_->virtualViewHysteresisRatio();
1250
1268
  virtualViewHysteresisRatio_ = flagValue;
@@ -1262,7 +1280,7 @@ double ReactNativeFeatureFlagsAccessor::virtualViewPrerenderRatio() {
1262
1280
  // be accessing the provider multiple times but the end state of this
1263
1281
  // instance and the returned flag value would be the same.
1264
1282
 
1265
- markFlagAsAccessed(68, "virtualViewPrerenderRatio");
1283
+ markFlagAsAccessed(69, "virtualViewPrerenderRatio");
1266
1284
 
1267
1285
  flagValue = currentProvider_->virtualViewPrerenderRatio();
1268
1286
  virtualViewPrerenderRatio_ = flagValue;
@@ -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<<f1eb31a7412bff743a5c581224d71e2a>>
7
+ * @generated SignedSource<<8131db9fc73621cf2a63be9d775dfc3d>>
8
8
  */
9
9
 
10
10
  /**
@@ -76,6 +76,7 @@ class ReactNativeFeatureFlagsAccessor {
76
76
  bool enableVirtualViewDebugFeatures();
77
77
  bool enableVirtualViewRenderState();
78
78
  bool enableVirtualViewWindowFocusDetection();
79
+ bool enableWebPerformanceAPIsByDefault();
79
80
  bool fixMappingOfEventPrioritiesBetweenFabricAndReact();
80
81
  bool fuseboxEnabledRelease();
81
82
  bool fuseboxNetworkInspectionEnabled();
@@ -112,7 +113,7 @@ class ReactNativeFeatureFlagsAccessor {
112
113
  std::unique_ptr<ReactNativeFeatureFlagsProvider> currentProvider_;
113
114
  bool wasOverridden_;
114
115
 
115
- std::array<std::atomic<const char*>, 69> accessedFeatureFlags_;
116
+ std::array<std::atomic<const char*>, 70> accessedFeatureFlags_;
116
117
 
117
118
  std::atomic<std::optional<bool>> commonTestFlag_;
118
119
  std::atomic<std::optional<bool>> cdpInteractionMetricsEnabled_;
@@ -158,6 +159,7 @@ class ReactNativeFeatureFlagsAccessor {
158
159
  std::atomic<std::optional<bool>> enableVirtualViewDebugFeatures_;
159
160
  std::atomic<std::optional<bool>> enableVirtualViewRenderState_;
160
161
  std::atomic<std::optional<bool>> enableVirtualViewWindowFocusDetection_;
162
+ std::atomic<std::optional<bool>> enableWebPerformanceAPIsByDefault_;
161
163
  std::atomic<std::optional<bool>> fixMappingOfEventPrioritiesBetweenFabricAndReact_;
162
164
  std::atomic<std::optional<bool>> fuseboxEnabledRelease_;
163
165
  std::atomic<std::optional<bool>> fuseboxNetworkInspectionEnabled_;
@@ -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<<a76f1a1e8ba0d65b689b4b87d33d7ced>>
7
+ * @generated SignedSource<<ca1bff402a7b8c5048b50e0a7c09c0da>>
8
8
  */
9
9
 
10
10
  /**
@@ -203,6 +203,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
203
203
  return false;
204
204
  }
205
205
 
206
+ bool enableWebPerformanceAPIsByDefault() override {
207
+ return false;
208
+ }
209
+
206
210
  bool fixMappingOfEventPrioritiesBetweenFabricAndReact() override {
207
211
  return false;
208
212
  }
@@ -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<<e2a5086e5586caf4c90ef503416a0e83>>
7
+ * @generated SignedSource<<4c8f1e40192bfd2c7ad52d7316aec273>>
8
8
  */
9
9
 
10
10
  /**
@@ -441,6 +441,15 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef
441
441
  return ReactNativeFeatureFlagsDefaults::enableVirtualViewWindowFocusDetection();
442
442
  }
443
443
 
444
+ bool enableWebPerformanceAPIsByDefault() override {
445
+ auto value = values_["enableWebPerformanceAPIsByDefault"];
446
+ if (!value.isNull()) {
447
+ return value.getBool();
448
+ }
449
+
450
+ return ReactNativeFeatureFlagsDefaults::enableWebPerformanceAPIsByDefault();
451
+ }
452
+
444
453
  bool fixMappingOfEventPrioritiesBetweenFabricAndReact() override {
445
454
  auto value = values_["fixMappingOfEventPrioritiesBetweenFabricAndReact"];
446
455
  if (!value.isNull()) {
@@ -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<<db8626cf78a3ed226bbbe6bf20cc03a2>>
7
+ * @generated SignedSource<<32a03e199994c91c022013d7929bfea5>>
8
8
  */
9
9
 
10
10
  /**
@@ -35,6 +35,10 @@ class ReactNativeFeatureFlagsOverridesOSSCanary : public ReactNativeFeatureFlags
35
35
  return true;
36
36
  }
37
37
 
38
+ bool enableWebPerformanceAPIsByDefault() override {
39
+ return true;
40
+ }
41
+
38
42
  bool useNativeViewConfigsInBridgelessMode() override {
39
43
  return true;
40
44
  }
@@ -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<<feb44bb7ec97d29787eac070103f9e1b>>
7
+ * @generated SignedSource<<70d501526baf497e55f9ca9a33b582ef>>
8
8
  */
9
9
 
10
10
  /**
@@ -69,6 +69,7 @@ class ReactNativeFeatureFlagsProvider {
69
69
  virtual bool enableVirtualViewDebugFeatures() = 0;
70
70
  virtual bool enableVirtualViewRenderState() = 0;
71
71
  virtual bool enableVirtualViewWindowFocusDetection() = 0;
72
+ virtual bool enableWebPerformanceAPIsByDefault() = 0;
72
73
  virtual bool fixMappingOfEventPrioritiesBetweenFabricAndReact() = 0;
73
74
  virtual bool fuseboxEnabledRelease() = 0;
74
75
  virtual bool fuseboxNetworkInspectionEnabled() = 0;
@@ -21,6 +21,7 @@ target_link_libraries(react_nativemodule_defaults
21
21
  react_nativemodule_featureflags
22
22
  react_nativemodule_microtasks
23
23
  react_nativemodule_idlecallbacks
24
+ react_nativemodule_webperformance
24
25
  )
25
26
  target_compile_reactnative_options(react_nativemodule_defaults PRIVATE)
26
27
  target_compile_options(react_nativemodule_defaults PRIVATE -Wpedantic)
@@ -6,10 +6,12 @@
6
6
  */
7
7
 
8
8
  #include "DefaultTurboModules.h"
9
+ #include <react/featureflags/ReactNativeFeatureFlags.h>
9
10
  #include <react/nativemodule/dom/NativeDOM.h>
10
11
  #include <react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h>
11
12
  #include <react/nativemodule/idlecallbacks/NativeIdleCallbacks.h>
12
13
  #include <react/nativemodule/microtasks/NativeMicrotasks.h>
14
+ #include <react/nativemodule/webperformance/NativePerformance.h>
13
15
 
14
16
  #ifdef REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY
15
17
  #include <react/nativemodule/devtoolsruntimesettings/DevToolsRuntimeSettingsModule.h>
@@ -36,6 +38,12 @@ namespace facebook::react {
36
38
  return std::make_shared<NativeDOM>(jsInvoker);
37
39
  }
38
40
 
41
+ if (ReactNativeFeatureFlags::enableWebPerformanceAPIsByDefault()) {
42
+ if (name == NativePerformance::kModuleName) {
43
+ return std::make_shared<NativePerformance>(jsInvoker);
44
+ }
45
+ }
46
+
39
47
  #ifdef REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY
40
48
  if (name == DevToolsRuntimeSettingsModule::kModuleName) {
41
49
  return std::make_shared<DevToolsRuntimeSettingsModule>(jsInvoker);
@@ -50,5 +50,6 @@ Pod::Spec.new do |s|
50
50
  s.dependency "React-featureflagsnativemodule"
51
51
  s.dependency "React-microtasksnativemodule"
52
52
  s.dependency "React-idlecallbacksnativemodule"
53
+ s.dependency "React-webperformancenativemodule"
53
54
  add_dependency(s, "React-RCTFBReactNativeSpec")
54
55
  end
@@ -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<<c9c36c1dbece9e27f7b71da7611cb747>>
7
+ * @generated SignedSource<<e95a083880ecb122d04f210bb05d404f>>
8
8
  */
9
9
 
10
10
  /**
@@ -264,6 +264,11 @@ bool NativeReactNativeFeatureFlags::enableVirtualViewWindowFocusDetection(
264
264
  return ReactNativeFeatureFlags::enableVirtualViewWindowFocusDetection();
265
265
  }
266
266
 
267
+ bool NativeReactNativeFeatureFlags::enableWebPerformanceAPIsByDefault(
268
+ jsi::Runtime& /*runtime*/) {
269
+ return ReactNativeFeatureFlags::enableWebPerformanceAPIsByDefault();
270
+ }
271
+
267
272
  bool NativeReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact(
268
273
  jsi::Runtime& /*runtime*/) {
269
274
  return ReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact();
@@ -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<<320e69fa54228a352fad210e3a43b947>>
7
+ * @generated SignedSource<<f7ca771b393e043210e73462e835fd24>>
8
8
  */
9
9
 
10
10
  /**
@@ -124,6 +124,8 @@ class NativeReactNativeFeatureFlags
124
124
 
125
125
  bool enableVirtualViewWindowFocusDetection(jsi::Runtime& runtime);
126
126
 
127
+ bool enableWebPerformanceAPIsByDefault(jsi::Runtime& runtime);
128
+
127
129
  bool fixMappingOfEventPrioritiesBetweenFabricAndReact(jsi::Runtime& runtime);
128
130
 
129
131
  bool fuseboxEnabledRelease(jsi::Runtime& runtime);
@@ -7,13 +7,13 @@ cmake_minimum_required(VERSION 3.13)
7
7
  set(CMAKE_VERBOSE_MAKEFILE on)
8
8
 
9
9
  include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake)
10
-
11
10
  file(GLOB react_nativemodule_webperformance_SRC CONFIGURE_DEPENDS *.cpp)
12
11
  add_library(react_nativemodule_webperformance OBJECT ${react_nativemodule_webperformance_SRC})
13
12
 
14
13
  target_include_directories(react_nativemodule_webperformance PUBLIC ${REACT_COMMON_DIR})
15
14
 
16
15
  target_link_libraries(react_nativemodule_webperformance
16
+ react_performance_timeline
17
17
  react_codegen_rncore
18
18
  react_cxxreact
19
19
  )
@@ -131,9 +131,18 @@ NativePerformance::NativePerformance(std::shared_ptr<CallInvoker> jsInvoker)
131
131
  : NativePerformanceCxxSpec(std::move(jsInvoker)) {}
132
132
 
133
133
  HighResTimeStamp NativePerformance::now(jsi::Runtime& /*rt*/) {
134
+ // This is not spec-compliant, as this is the duration from system boot to
135
+ // now, instead of from app startup to now.
136
+ // This should be carefully changed eventually.
134
137
  return HighResTimeStamp::now();
135
138
  }
136
139
 
140
+ HighResDuration NativePerformance::timeOrigin(jsi::Runtime& /*rt*/) {
141
+ // This is not spec-compliant, as this is an approximation from Unix epoch to
142
+ // system boot, instead of a precise duration from Unix epoch to app startup.
143
+ return HighResTimeStamp::unsafeOriginFromUnixTimeStamp();
144
+ }
145
+
137
146
  void NativePerformance::reportMark(
138
147
  jsi::Runtime& rt,
139
148
  const std::string& name,
@@ -274,15 +283,6 @@ NativePerformance::getReactNativeStartupTiming(jsi::Runtime& /*rt*/) {
274
283
  startupLogger.getRunJSBundleStartTime();
275
284
  }
276
285
 
277
- if (!std::isnan(startupLogger.getRunJSBundleEndTime())) {
278
- result["executeJavaScriptBundleEntryPointEnd"] =
279
- startupLogger.getRunJSBundleEndTime();
280
- }
281
-
282
- if (!std::isnan(startupLogger.getInitReactRuntimeEndTime())) {
283
- result["initializeRuntimeEnd"] = startupLogger.getInitReactRuntimeEndTime();
284
- }
285
-
286
286
  if (!std::isnan(startupLogger.getAppStartupEndTime())) {
287
287
  result["endTime"] = startupLogger.getAppStartupEndTime();
288
288
  }
@@ -88,6 +88,9 @@ class NativePerformance : public NativePerformanceCxxSpec<NativePerformance> {
88
88
  // https://www.w3.org/TR/hr-time-3/#now-method
89
89
  HighResTimeStamp now(jsi::Runtime& rt);
90
90
 
91
+ // https://www.w3.org/TR/hr-time-3/#timeorigin-attribute
92
+ HighResDuration timeOrigin(jsi::Runtime& rt);
93
+
91
94
  #pragma mark - User Timing Level 3 functions (https://w3c.github.io/user-timing/)
92
95
 
93
96
  void reportMark(
@@ -0,0 +1,58 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ #
3
+ # This source code is licensed under the MIT license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+ require "json"
7
+
8
+ package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "..", "package.json")))
9
+ version = package['version']
10
+
11
+ source = { :git => 'https://github.com/facebook/react-native.git' }
12
+ if version == '1000.0.0'
13
+ # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14
+ source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
15
+ else
16
+ source[:tag] = "v#{version}"
17
+ end
18
+
19
+ header_search_paths = []
20
+
21
+ if ENV['USE_FRAMEWORKS']
22
+ header_search_paths << "\"$(PODS_TARGET_SRCROOT)/../../..\"" # this is needed to allow the module access its own files
23
+ end
24
+
25
+ Pod::Spec.new do |s|
26
+ s.name = "React-webperformancenativemodule"
27
+ s.version = version
28
+ s.summary = "React Native idle callbacks native module"
29
+ s.homepage = "https://reactnative.dev/"
30
+ s.license = package["license"]
31
+ s.author = "Meta Platforms, Inc. and its affiliates"
32
+ s.platforms = min_supported_versions
33
+ s.source = source
34
+ s.source_files = podspec_sources("*.{cpp,h}", "*.h")
35
+ s.header_dir = "react/nativemodule/webperformance"
36
+ s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
37
+ "HEADER_SEARCH_PATHS" => header_search_paths.join(' '),
38
+ "OTHER_CFLAGS" => "$(inherited)",
39
+ "DEFINES_MODULE" => "YES" }
40
+
41
+ if ENV['USE_FRAMEWORKS']
42
+ s.module_name = "webperformancenativemodule"
43
+ s.header_mappings_dir = "../.."
44
+ end
45
+
46
+ s.dependency "React-jsi"
47
+ s.dependency "React-jsiexecutor"
48
+
49
+ depend_on_js_engine(s)
50
+ add_rn_third_party_dependencies(s)
51
+ add_rncore_dependency(s)
52
+
53
+ s.dependency "ReactCommon/turbomodule/core"
54
+ add_dependency(s, "React-RCTFBReactNativeSpec")
55
+ add_dependency(s, "React-performancetimeline")
56
+ add_dependency(s, "React-runtimeexecutor", :additional_framework_paths => ["platform/ios"])
57
+
58
+ end
@@ -19,7 +19,7 @@ target_compile_reactnative_options(bridgeless PRIVATE)
19
19
  if(${CMAKE_BUILD_TYPE} MATCHES Debug OR REACT_NATIVE_DEBUG_OPTIMIZED)
20
20
  target_compile_options(bridgeless PRIVATE -DHERMES_ENABLE_DEBUGGER=1)
21
21
 
22
- if (DEFINED HERMES_V1_ENABLED)
22
+ if (HERMES_V1_ENABLED)
23
23
  target_compile_options(bridgeless PRIVATE -DHERMES_V1_ENABLED=1)
24
24
  endif()
25
25
  endif ()
@@ -36,7 +36,7 @@ if(${CMAKE_BUILD_TYPE} MATCHES Debug OR REACT_NATIVE_DEBUG_OPTIMIZED)
36
36
  -DHERMES_ENABLE_DEBUGGER=1
37
37
  )
38
38
 
39
- if (DEFINED HERMES_V1_ENABLED)
39
+ if (HERMES_V1_ENABLED)
40
40
  target_compile_options(bridgelesshermes PRIVATE -DHERMES_V1_ENABLED=1)
41
41
  endif()
42
42
  endif()
@@ -201,6 +201,11 @@ class HighResTimeStamp {
201
201
  return HighResTimeStamp(chronoNow());
202
202
  }
203
203
 
204
+ static HighResDuration unsafeOriginFromUnixTimeStamp() noexcept {
205
+ static auto origin = computeUnsafeOriginFromUnixTimeStamp();
206
+ return origin;
207
+ }
208
+
204
209
  static constexpr HighResTimeStamp min() noexcept {
205
210
  return HighResTimeStamp(std::chrono::steady_clock::time_point::min());
206
211
  }
@@ -285,6 +290,13 @@ class HighResTimeStamp {
285
290
 
286
291
  std::chrono::steady_clock::time_point chronoTimePoint_;
287
292
 
293
+ static HighResDuration computeUnsafeOriginFromUnixTimeStamp() noexcept {
294
+ auto systemNow = std::chrono::system_clock::now();
295
+ auto steadyNow = std::chrono::steady_clock::now();
296
+ return HighResDuration(
297
+ systemNow.time_since_epoch() - steadyNow.time_since_epoch());
298
+ }
299
+
288
300
  #ifdef REACT_NATIVE_DEBUG
289
301
  static std::function<std::chrono::steady_clock::time_point()>&
290
302
  getTimeStampProvider() {
package/flow/bom.js.flow CHANGED
@@ -199,11 +199,11 @@ declare interface EventCounts {
199
199
  }
200
200
 
201
201
  declare class Performance {
202
- clearMarks(name?: string): void;
202
+ +eventCounts: EventCounts;
203
+ +timeOrigin: DOMHighResTimeStamp;
203
204
 
205
+ clearMarks(name?: string): void;
204
206
  clearMeasures(name?: string): void;
205
-
206
- eventCounts: EventCounts;
207
207
  getEntries: (
208
208
  options?: PerformanceEntryFilterOptions,
209
209
  ) => Array<PerformanceEntry>;
@@ -215,7 +215,7 @@ declare class Performance {
215
215
  startMarkOrOptions?: string | PerformanceMeasureOptions,
216
216
  endMark?: string,
217
217
  ): PerformanceMeasure;
218
- now: () => DOMHighResTimeStamp;
218
+ now(): DOMHighResTimeStamp;
219
219
  toJSON(): string;
220
220
  }
221
221