mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/45236 Changelog: [internal] ## Context We're currently observing inconsistencies between the state of the UI on Android and the propagated state in Fabric. When investigating the issue, we saw that there are some state updates that were going to be dispatched from scroll views to Fabric were skipped because the state object in native was deallocated. The reason for that is a race condition between: 1. Dispatching new state updates from the UI thread 2. Updating the state previously dispatched from the UI thread on the JS thread. {F1735383134} ## Changes This creates a new feature flag to replace the weak reference with a strong one, so when the previous state is deallocated we can still access it to set new state. The use of weak references was introduced in D44472121 to avoid holding onto JSI references (which could be contained in the state) when the runtime was deallocated, but we later introduced an explicit clean up mechanism in D45905628 that would make that unnecessary. Reviewed By: javache Differential Revision: D59233070 fbshipit-source-id: 018d8935f506430ecab96df0f7a998a37ee0f556
171 lines
5.6 KiB
C++
171 lines
5.6 KiB
C++
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @generated SignedSource<<58b0c0c49dc6cf2ecdbc2c3038395e4e>>
|
|
*/
|
|
|
|
/**
|
|
* IMPORTANT: Do NOT modify this file directly.
|
|
*
|
|
* To change the definition of the flags, edit
|
|
* packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js.
|
|
*
|
|
* To regenerate this code, run the following script from the repo root:
|
|
* yarn featureflags-update
|
|
*/
|
|
|
|
#include "NativeReactNativeFeatureFlags.h"
|
|
#include <react/featureflags/ReactNativeFeatureFlags.h>
|
|
|
|
#ifdef RN_DISABLE_OSS_PLUGIN_HEADER
|
|
#include "Plugins.h"
|
|
#endif
|
|
|
|
std::shared_ptr<facebook::react::TurboModule>
|
|
NativeReactNativeFeatureFlagsModuleProvider(
|
|
std::shared_ptr<facebook::react::CallInvoker> jsInvoker) {
|
|
return std::make_shared<facebook::react::NativeReactNativeFeatureFlags>(
|
|
std::move(jsInvoker));
|
|
}
|
|
|
|
namespace facebook::react {
|
|
|
|
NativeReactNativeFeatureFlags::NativeReactNativeFeatureFlags(
|
|
std::shared_ptr<CallInvoker> jsInvoker)
|
|
: NativeReactNativeFeatureFlagsCxxSpec(std::move(jsInvoker)) {}
|
|
|
|
bool NativeReactNativeFeatureFlags::commonTestFlag(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::commonTestFlag();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::allowCollapsableChildren(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::allowCollapsableChildren();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::allowRecursiveCommitsWithSynchronousMountOnAndroid(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::allowRecursiveCommitsWithSynchronousMountOnAndroid();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::batchRenderingUpdatesInEventLoop(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::batchRenderingUpdatesInEventLoop();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::destroyFabricSurfacesInReactInstanceManager(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::destroyFabricSurfacesInReactInstanceManager();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableBackgroundExecutor(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableBackgroundExecutor();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableCleanTextInputYogaNode(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableCleanTextInputYogaNode();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableGranularShadowTreeStateReconciliation(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableGranularShadowTreeStateReconciliation();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableMicrotasks(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableMicrotasks();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableSynchronousStateUpdates(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableSynchronousStateUpdates();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::enableUIConsistency(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::enableUIConsistency();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::fixMissedFabricStateUpdatesOnAndroid(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::fixMissedFabricStateUpdatesOnAndroid();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeak(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeak();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::forceBatchingMountItemsOnAndroid(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::forceBatchingMountItemsOnAndroid();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::fuseboxEnabledDebug(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::fuseboxEnabledDebug();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::fuseboxEnabledRelease(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::fuseboxEnabledRelease();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::lazyAnimationCallbacks(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::lazyAnimationCallbacks();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::preventDoubleTextMeasure(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::preventDoubleTextMeasure();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::setAndroidLayoutDirection(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::setAndroidLayoutDirection();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::useImmediateExecutorInAndroidBridgeless(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::useImmediateExecutorInAndroidBridgeless();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::useModernRuntimeScheduler(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::useModernRuntimeScheduler();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::useNativeViewConfigsInBridgelessMode(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::useNativeViewConfigsInBridgelessMode();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::useRuntimeShadowNodeReferenceUpdate(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::useRuntimeShadowNodeReferenceUpdate();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::useRuntimeShadowNodeReferenceUpdateOnLayout(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::useRuntimeShadowNodeReferenceUpdateOnLayout();
|
|
}
|
|
|
|
bool NativeReactNativeFeatureFlags::useStateAlignmentMechanism(
|
|
jsi::Runtime& /*runtime*/) {
|
|
return ReactNativeFeatureFlags::useStateAlignmentMechanism();
|
|
}
|
|
|
|
} // namespace facebook::react
|