mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Event merging or "coalescing" is done on Java side from Android, but Fabric also includes some Cxx logic to merge those events. Although Android doesn't need this logic in particular, it is important to follow this path to ensure these events (e.g. scroll) are dispatched as "continuous", allowing for correct prioritization in Concurrent Mode. `dispatchModernV2` selects between `dispatch` and `dispatchUnique` based on the `canBeCoalesced` parameter of the event, which is exactly what we need. The logic is only used in the "new" event dispatcher at the moment, so I wrapped it with feature flag to validate it doesn't cause any regressions. Changelog: [Android][Internal] - Try dispatching coalescing events as unique to Fabric Reviewed By: sammy-SC Differential Revision: D31272585 fbshipit-source-id: 6b67b61bd13fbff019d9eb8c5172bdd814a7b5b8
107 lines
4.1 KiB
Java
107 lines
4.1 KiB
Java
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
package com.facebook.react.config;
|
|
|
|
import com.facebook.proguard.annotations.DoNotStripAny;
|
|
|
|
/**
|
|
* Hi there, traveller! This configuration class is not meant to be used by end-users of RN. It
|
|
* contains mainly flags for features that are either under active development and not ready for
|
|
* public consumption, or for use in experiments.
|
|
*
|
|
* <p>These values are safe defaults and should not require manual changes.
|
|
*/
|
|
@DoNotStripAny
|
|
public class ReactFeatureFlags {
|
|
/**
|
|
* Should this application use TurboModules? If yes, then any module that inherits {@link
|
|
* com.facebook.react.turbomodule.core.interfaces.TurboModule} will NOT be passed in to C++
|
|
* CatalystInstanceImpl
|
|
*/
|
|
public static volatile boolean useTurboModules = false;
|
|
|
|
/**
|
|
* Should this application use the new (Fabric) Renderer? If yes, all rendering in this app will
|
|
* use Fabric instead of the legacy renderer.
|
|
*/
|
|
public static volatile boolean enableFabricRenderer = false;
|
|
|
|
/**
|
|
* After TurboModules and Fabric are enabled, we need to ensure that the legacy NativeModule isn't
|
|
* isn't used. So, turn this flag on to trigger warnings whenever the legacy NativeModule system
|
|
* is used.
|
|
*/
|
|
public static volatile boolean warnOnLegacyNativeModuleSystemUse = false;
|
|
|
|
/** Should we dispatch TurboModule methods with promise returns to the NativeModules thread? */
|
|
public static volatile boolean enableTurboModulePromiseAsyncDispatch = false;
|
|
|
|
/**
|
|
* Experiment:
|
|
*
|
|
* <p>Bridge and Bridgeless mode can run concurrently. This means that there can be two
|
|
* TurboModule systems alive at the same time.
|
|
*
|
|
* <p>The TurboModule system stores all JS callbacks in a global LongLivedObjectCollection. This
|
|
* collection is cleared when the JS VM is torn down. Implication: Tearing down the bridge JSVM
|
|
* invalidates the bridgeless JSVM's callbacks, and vice versa.
|
|
*
|
|
* <p>useGlobalCallbackCleanupScopeUsingRetainJSCallback => Use a retainJSCallbacks lambda to
|
|
* store jsi::Functions into the global LongLivedObjectCollection
|
|
*
|
|
* <p>useTurboModuleManagerCallbackCleanupScope => Use a retainJSCallbacks labmda to store
|
|
* jsi::Functions into a LongLivedObjectCollection owned by the TurboModuleManager
|
|
*/
|
|
public static boolean useGlobalCallbackCleanupScopeUsingRetainJSCallback = false;
|
|
|
|
public static boolean useTurboModuleManagerCallbackCleanupScope = false;
|
|
|
|
/** This feature flag enables logs for Fabric */
|
|
public static boolean enableFabricLogs = false;
|
|
|
|
/** Feature flag to configure eager initialization of Fabric */
|
|
public static boolean eagerInitializeFabric = false;
|
|
|
|
/** Enables Static ViewConfig in RN Android native code. */
|
|
public static boolean enableExperimentalStaticViewConfigs = false;
|
|
|
|
public static boolean enableRuntimeScheduler = false;
|
|
|
|
public static boolean enableRuntimeSchedulerInTurboModule = false;
|
|
|
|
/** Enables a more aggressive cleanup during destruction of ReactContext */
|
|
public static boolean enableReactContextCleanupFix = false;
|
|
|
|
/** Feature flag to configure eager initialization of MapBuffer So file */
|
|
public static boolean enableEagerInitializeMapBufferSoFile = false;
|
|
|
|
private static boolean mapBufferSerializationEnabled = false;
|
|
|
|
/** Enables or disables MapBuffer Serialization */
|
|
public static void setMapBufferSerializationEnabled(boolean enabled) {
|
|
mapBufferSerializationEnabled = enabled;
|
|
}
|
|
|
|
public static boolean isMapBufferSerializationEnabled() {
|
|
return mapBufferSerializationEnabled;
|
|
}
|
|
|
|
/** Enables Fabric for LogBox */
|
|
public static boolean enableFabricInLogBox = false;
|
|
|
|
public static boolean enableLockFreeEventDispatcher = false;
|
|
|
|
public static boolean enableAggressiveEventEmitterCleanup = false;
|
|
|
|
public static boolean insertZReorderBarriersOnViewGroupChildren = true;
|
|
|
|
public static boolean enableScrollViewSnapToAlignmentProp = true;
|
|
|
|
public static boolean useDispatchUniqueForCoalescableEvents = false;
|
|
}
|