Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete CoreFeatures::enableReportEventPaintTime #45625

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
#import <React/RCTConstants.h>
#import <React/RCTScrollEvent.h>

#import <react/featureflags/ReactNativeFeatureFlags.h>
#import <react/renderer/components/scrollview/RCTComponentViewHelpers.h>
#import <react/renderer/components/scrollview/ScrollViewComponentDescriptor.h>
#import <react/renderer/components/scrollview/ScrollViewEventEmitter.h>
#import <react/renderer/components/scrollview/ScrollViewProps.h>
#import <react/renderer/components/scrollview/ScrollViewState.h>
#import <react/renderer/components/scrollview/conversions.h>

#include <react/utils/CoreFeatures.h>
#import "RCTConversions.h"
#import "RCTCustomPullToRefreshViewProtocol.h"
#import "RCTEnhancedScrollView.h"
Expand Down Expand Up @@ -501,7 +503,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView
});
}
} else {
if (!_isUserTriggeredScrolling || CoreFeatures::enableGranularScrollViewStateUpdatesIOS) {
if (!_isUserTriggeredScrolling || ReactNativeFeatureFlags::enableGranularScrollViewStateUpdatesIOS()) {
[self _updateStateWithContentOffset];
}

Expand Down
11 changes: 0 additions & 11 deletions packages/react-native/React/Fabric/RCTSurfacePresenter.mm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#import <react/renderer/scheduler/AsynchronousEventBeat.h>
#import <react/renderer/scheduler/SchedulerToolbox.h>
#import <react/utils/ContextContainer.h>
#import <react/utils/CoreFeatures.h>
#import <react/utils/ManagedObjectWrapper.h>

#import "PlatformRunLoopObserver.h"
Expand Down Expand Up @@ -227,16 +226,6 @@ - (BOOL)resume

- (RCTScheduler *)_createScheduler
{
auto reactNativeConfig = _contextContainer->at<std::shared_ptr<const ReactNativeConfig>>("ReactNativeConfig");

if (reactNativeConfig && reactNativeConfig->getBool("react_fabric:enable_cpp_props_iterator_setter_ios")) {
CoreFeatures::enablePropIteratorSetter = true;
}

if (reactNativeConfig && reactNativeConfig->getBool("react_fabric:enable_granular_scroll_view_state_updates_ios")) {
CoreFeatures::enableGranularScrollViewStateUpdatesIOS = true;
}

auto componentRegistryFactory =
[factory = wrapManagedObject(_mountingManager.componentViewRegistry.componentViewFactory)](
const EventDispatcher::Weak &eventDispatcher, const ContextContainer::Shared &contextContainer) {
Expand Down
5 changes: 0 additions & 5 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -1964,13 +1964,8 @@ public class com/facebook/react/common/network/OkHttpCallUtil {
public class com/facebook/react/config/ReactFeatureFlags {
public static field dispatchPointerEvents Z
public static field enableBridgelessArchitecture Z
public static field enableCppPropsIteratorSetter Z
public static field enableEagerRootViewAttachment Z
public static field enableFabricLogs Z
public static field enableFabricRenderer Z
public static field enableViewRecycling Z
public static field traceTurboModulePromiseRejections Z
public static field unstable_enableTurboModuleSyncVoidMethods Z
public static field unstable_useFabricInterop Z
public static field unstable_useTurboModuleInterop Z
public static field useTurboModules Z
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.config.ReactFeatureFlags;
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags;
import com.facebook.react.internal.turbomodule.core.TurboModuleManagerDelegate;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.module.model.ReactModuleInfo;
Expand All @@ -40,7 +41,7 @@ interface ModuleProvider {
&& ReactFeatureFlags.unstable_useTurboModuleInterop;

private final boolean mEnableTurboModuleSyncVoidMethods =
ReactFeatureFlags.unstable_enableTurboModuleSyncVoidMethods;
ReactNativeFeatureFlags.unstable_enableTurboModuleSyncVoidMethods();

// Lazy Props
private List<ReactPackage> mPackages;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import com.facebook.react.bridge.WritableNativeMap;
import com.facebook.react.common.annotations.VisibleForTesting;
import com.facebook.react.config.ReactFeatureFlags;
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags;
import com.facebook.react.modules.appregistry.AppRegistry;
import com.facebook.react.modules.deviceinfo.DeviceInfoModule;
import com.facebook.react.uimanager.DisplayMetricsHolder;
Expand Down Expand Up @@ -478,7 +479,7 @@ public void startReactApplication(
mReactInstanceManager.createReactContextInBackground();
// if in this experiment, we initialize the root earlier in startReactApplication
// instead of waiting for the initial measure
if (ReactFeatureFlags.enableEagerRootViewAttachment) {
if (ReactNativeFeatureFlags.enableEagerRootViewAttachment()) {
if (!mWasMeasured) {
// Ideally, those values will be used by default, but we only update them here to scope
// this change to `enableEagerRootViewAttachment` experiment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import com.facebook.infer.annotation.Nullsafe;
import com.facebook.proguard.annotations.DoNotStripAny;
import com.facebook.react.common.build.ReactBuildConfig;

/**
* Hi there, traveller! This configuration class is not meant to be used by end-users of RN. It
Expand All @@ -32,12 +31,6 @@ public class ReactFeatureFlags {
/** In Bridgeless mode, should legacy NativeModules use the TurboModule system? */
public static volatile boolean unstable_useTurboModuleInterop = false;

/**
* By default, native module methods that return void run asynchronously. This flag will make
* execution of void methods in TurboModules stay on the JS thread.
*/
public static volatile boolean unstable_enableTurboModuleSyncVoidMethods = false;

/**
* Should this application use the new (Fabric) Renderer? If yes, all rendering in this app will
* use Fabric instead of the legacy renderer.
Expand All @@ -58,27 +51,10 @@ public class ReactFeatureFlags {
*/
public static boolean enableBridgelessArchitecture = false;

/** This feature flag enables logs for Fabric */
public static boolean enableFabricLogs = false;

/** Feature flag to configure eager attachment of the root view/initialisation of the JS code */
public static boolean enableEagerRootViewAttachment = false;

public static boolean dispatchPointerEvents = false;

/**
* Feature Flag to enable View Recycling. When enabled, individual ViewManagers must still opt-in.
*/
public static boolean enableViewRecycling = false;

/**
* Enable prop iterator setter-style construction of Props in C++ (this flag is not used in Java).
*/
public static boolean enableCppPropsIteratorSetter = false;

/**
* Enables storing js caller stack when creating promise in native module. This is useful in case
* of Promise rejection and tracing the cause.
*/
public static boolean traceTurboModulePromiseRejections = ReactBuildConfig.DEBUG;
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public class FabricUIManager
// development environment. DO NOT ENABLE THIS ON PRODUCTION OR YOU WILL BE FIRED!
public static final boolean IS_DEVELOPMENT_ENVIRONMENT = false && ReactBuildConfig.DEBUG;
public static final boolean ENABLE_FABRIC_LOGS =
ReactFeatureFlags.enableFabricLogs
ReactNativeFeatureFlags.enableFabricLogs()
|| PrinterHolder.getPrinter()
.shouldDisplayLogMessage(ReactDebugOverlayTags.FABRIC_UI_MANAGER);
public static final boolean ENABLE_FABRIC_PERF_LOGS = ENABLE_FABRIC_LOGS || false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<ca939ab47fa68fbb5acf5ea34481def9>>
* @generated SignedSource<<bd375056cfcd982392e7eb25b5806f18>>
*/

/**
Expand Down Expand Up @@ -82,12 +82,36 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun enableCleanTextInputYogaNode(): Boolean = accessor.enableCleanTextInputYogaNode()

/**
* Enable prop iterator setter-style construction of Props in C++ (this flag is not used in Java).
*/
@JvmStatic
public fun enableCppPropsIteratorSetter(): Boolean = accessor.enableCppPropsIteratorSetter()

/**
* Feature flag to configure eager attachment of the root view/initialisation of the JS code.
*/
@JvmStatic
public fun enableEagerRootViewAttachment(): Boolean = accessor.enableEagerRootViewAttachment()

/**
* This feature flag enables logs for Fabric.
*/
@JvmStatic
public fun enableFabricLogs(): Boolean = accessor.enableFabricLogs()

/**
* When the app is completely migrated to Fabric, set this flag to true to disable parts of Paper infrastructure that are not needed anymore but consume memory and CPU. Specifically, UIViewOperationQueue and EventDispatcherImpl will no longer work as they will not subscribe to ReactChoreographer for updates.
*/
@JvmStatic
public fun enableFabricRendererExclusively(): Boolean = accessor.enableFabricRendererExclusively()

/**
* When enabled, RCTScrollViewComponentView will trigger ShadowTree state updates for all changes in scroll position.
*/
@JvmStatic
public fun enableGranularScrollViewStateUpdatesIOS(): Boolean = accessor.enableGranularScrollViewStateUpdatesIOS()

/**
* When enabled, the renderer would only fail commits when they propagate state and the last commit that updated state changed before committing.
*/
Expand Down Expand Up @@ -202,6 +226,18 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun setAndroidLayoutDirection(): Boolean = accessor.setAndroidLayoutDirection()

/**
* Enables storing js caller stack when creating promise in native module. This is useful in case of Promise rejection and tracing the cause.
*/
@JvmStatic
public fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean = accessor.traceTurboModulePromiseRejectionsOnAndroid()

/**
* By default, native module methods that return void run asynchronously. This flag will make execution of void methods in TurboModules stay on the JS thread.
*/
@JvmStatic
public fun unstable_enableTurboModuleSyncVoidMethods(): Boolean = accessor.unstable_enableTurboModuleSyncVoidMethods()

/**
* Invoke callbacks immediately on the ReactInstance rather than going through a background thread for synchronization
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<2a8d5ca8a0ac46b4d3177cb8b12ad7ac>>
* @generated SignedSource<<3792bade51d906046c772bda42edaa09>>
*/

/**
Expand All @@ -29,7 +29,11 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
private var destroyFabricSurfacesInReactInstanceManagerCache: Boolean? = null
private var enableAlignItemsBaselineOnFabricIOSCache: Boolean? = null
private var enableCleanTextInputYogaNodeCache: Boolean? = null
private var enableCppPropsIteratorSetterCache: Boolean? = null
private var enableEagerRootViewAttachmentCache: Boolean? = null
private var enableFabricLogsCache: Boolean? = null
private var enableFabricRendererExclusivelyCache: Boolean? = null
private var enableGranularScrollViewStateUpdatesIOSCache: Boolean? = null
private var enableGranularShadowTreeStateReconciliationCache: Boolean? = null
private var enableLongTaskAPICache: Boolean? = null
private var enableMicrotasksCache: Boolean? = null
Expand All @@ -49,6 +53,8 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
private var lazyAnimationCallbacksCache: Boolean? = null
private var loadVectorDrawablesOnImagesCache: Boolean? = null
private var setAndroidLayoutDirectionCache: Boolean? = null
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
private var unstable_enableTurboModuleSyncVoidMethodsCache: Boolean? = null
private var useImmediateExecutorInAndroidBridgelessCache: Boolean? = null
private var useModernRuntimeSchedulerCache: Boolean? = null
private var useNativeViewConfigsInBridgelessModeCache: Boolean? = null
Expand Down Expand Up @@ -139,6 +145,33 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
return cached
}

override fun enableCppPropsIteratorSetter(): Boolean {
var cached = enableCppPropsIteratorSetterCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enableCppPropsIteratorSetter()
enableCppPropsIteratorSetterCache = cached
}
return cached
}

override fun enableEagerRootViewAttachment(): Boolean {
var cached = enableEagerRootViewAttachmentCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enableEagerRootViewAttachment()
enableEagerRootViewAttachmentCache = cached
}
return cached
}

override fun enableFabricLogs(): Boolean {
var cached = enableFabricLogsCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enableFabricLogs()
enableFabricLogsCache = cached
}
return cached
}

override fun enableFabricRendererExclusively(): Boolean {
var cached = enableFabricRendererExclusivelyCache
if (cached == null) {
Expand All @@ -148,6 +181,15 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
return cached
}

override fun enableGranularScrollViewStateUpdatesIOS(): Boolean {
var cached = enableGranularScrollViewStateUpdatesIOSCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enableGranularScrollViewStateUpdatesIOS()
enableGranularScrollViewStateUpdatesIOSCache = cached
}
return cached
}

override fun enableGranularShadowTreeStateReconciliation(): Boolean {
var cached = enableGranularShadowTreeStateReconciliationCache
if (cached == null) {
Expand Down Expand Up @@ -319,6 +361,24 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
return cached
}

override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean {
var cached = traceTurboModulePromiseRejectionsOnAndroidCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.traceTurboModulePromiseRejectionsOnAndroid()
traceTurboModulePromiseRejectionsOnAndroidCache = cached
}
return cached
}

override fun unstable_enableTurboModuleSyncVoidMethods(): Boolean {
var cached = unstable_enableTurboModuleSyncVoidMethodsCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.unstable_enableTurboModuleSyncVoidMethods()
unstable_enableTurboModuleSyncVoidMethodsCache = cached
}
return cached
}

override fun useImmediateExecutorInAndroidBridgeless(): Boolean {
var cached = useImmediateExecutorInAndroidBridgelessCache
if (cached == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<aaf205098eaac9171aa15bc8f7bda805>>
* @generated SignedSource<<77a1724d3b923becb1c19ec99dd0fb14>>
*/

/**
Expand Down Expand Up @@ -46,8 +46,16 @@ public object ReactNativeFeatureFlagsCxxInterop {

@DoNotStrip @JvmStatic public external fun enableCleanTextInputYogaNode(): Boolean

@DoNotStrip @JvmStatic public external fun enableCppPropsIteratorSetter(): Boolean

@DoNotStrip @JvmStatic public external fun enableEagerRootViewAttachment(): Boolean

@DoNotStrip @JvmStatic public external fun enableFabricLogs(): Boolean

@DoNotStrip @JvmStatic public external fun enableFabricRendererExclusively(): Boolean

@DoNotStrip @JvmStatic public external fun enableGranularScrollViewStateUpdatesIOS(): Boolean

@DoNotStrip @JvmStatic public external fun enableGranularShadowTreeStateReconciliation(): Boolean

@DoNotStrip @JvmStatic public external fun enableLongTaskAPI(): Boolean
Expand Down Expand Up @@ -86,6 +94,10 @@ public object ReactNativeFeatureFlagsCxxInterop {

@DoNotStrip @JvmStatic public external fun setAndroidLayoutDirection(): Boolean

@DoNotStrip @JvmStatic public external fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean

@DoNotStrip @JvmStatic public external fun unstable_enableTurboModuleSyncVoidMethods(): Boolean

@DoNotStrip @JvmStatic public external fun useImmediateExecutorInAndroidBridgeless(): Boolean

@DoNotStrip @JvmStatic public external fun useModernRuntimeScheduler(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<abdee8d0b85b0d9940207b9cbe6d3f78>>
* @generated SignedSource<<a391d1062f5e22cdd006d828458c2cfa>>
*/

/**
Expand Down Expand Up @@ -41,8 +41,16 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi

override fun enableCleanTextInputYogaNode(): Boolean = false

override fun enableCppPropsIteratorSetter(): Boolean = false

override fun enableEagerRootViewAttachment(): Boolean = false

override fun enableFabricLogs(): Boolean = false

override fun enableFabricRendererExclusively(): Boolean = false

override fun enableGranularScrollViewStateUpdatesIOS(): Boolean = false

override fun enableGranularShadowTreeStateReconciliation(): Boolean = false

override fun enableLongTaskAPI(): Boolean = false
Expand Down Expand Up @@ -81,6 +89,10 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi

override fun setAndroidLayoutDirection(): Boolean = true

override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean = false

override fun unstable_enableTurboModuleSyncVoidMethods(): Boolean = false

override fun useImmediateExecutorInAndroidBridgeless(): Boolean = false

override fun useModernRuntimeScheduler(): Boolean = false
Expand Down
Loading
Loading