delete feature flag excludeYogaFromRawProps (#49817)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49817

changelog: [internal]

Remove feature flag excludeYogaFromRawProps. It did not yield any performance wins and the code to support the feature is spread across multiple classes. Removal simplifies complexity.

Reviewed By: javache

Differential Revision: D70389071

fbshipit-source-id: 21751f56aec8de501ff1e1efafda035069d8ef48
This commit is contained in:
Samuel Susla
2025-03-11 09:10:22 -07:00
committed by Facebook GitHub Bot
parent ff84ae9188
commit cf39e6164c
27 changed files with 40 additions and 317 deletions
@@ -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<<7385ae14a1980ddefd036ba808459a11>>
* @generated SignedSource<<e5e17b9d0c91c979f09cbdc0314f4cf2>>
*/
/**
@@ -172,12 +172,6 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun enableViewRecyclingForView(): Boolean = accessor.enableViewRecyclingForView()
/**
* When enabled, rawProps in Props will not include Yoga specific props.
*/
@JvmStatic
public fun excludeYogaFromRawProps(): Boolean = accessor.excludeYogaFromRawProps()
/**
* Fixes a bug in Differentiator where parent views may be referenced before they're created
*/
@@ -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<<33b79b398811a36129c3da6af16ff827>>
* @generated SignedSource<<e567bf1ac6ec5d0381deed1245b22a3f>>
*/
/**
@@ -44,7 +44,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var enableViewRecyclingCache: Boolean? = null
private var enableViewRecyclingForTextCache: Boolean? = null
private var enableViewRecyclingForViewCache: Boolean? = null
private var excludeYogaFromRawPropsCache: Boolean? = null
private var fixDifferentiatorEmittingUpdatesWithWrongParentTagCache: Boolean? = null
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
private var fixMountingCoordinatorReportedPendingTransactionsOnAndroidCache: Boolean? = null
@@ -279,15 +278,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}
override fun excludeYogaFromRawProps(): Boolean {
var cached = excludeYogaFromRawPropsCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.excludeYogaFromRawProps()
excludeYogaFromRawPropsCache = cached
}
return cached
}
override fun fixDifferentiatorEmittingUpdatesWithWrongParentTag(): Boolean {
var cached = fixDifferentiatorEmittingUpdatesWithWrongParentTagCache
if (cached == null) {
@@ -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<<f6612567270152579f69a4a9b7991c6f>>
* @generated SignedSource<<1e7421f38e1dd6629e42492b2c7a4ee1>>
*/
/**
@@ -76,8 +76,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
@DoNotStrip @JvmStatic public external fun enableViewRecyclingForView(): Boolean
@DoNotStrip @JvmStatic public external fun excludeYogaFromRawProps(): Boolean
@DoNotStrip @JvmStatic public external fun fixDifferentiatorEmittingUpdatesWithWrongParentTag(): Boolean
@DoNotStrip @JvmStatic public external fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean
@@ -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<<720cf7d788048f52cc3609c9c8a98e4a>>
* @generated SignedSource<<0f22538afea52085aaf605e8608eaff8>>
*/
/**
@@ -71,8 +71,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
override fun enableViewRecyclingForView(): Boolean = true
override fun excludeYogaFromRawProps(): Boolean = false
override fun fixDifferentiatorEmittingUpdatesWithWrongParentTag(): Boolean = true
override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean = false
@@ -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<<c618978f77362c0a6c46c2ec1e9ae64d>>
* @generated SignedSource<<1693dced312625bbfedce5f2dfa9816c>>
*/
/**
@@ -48,7 +48,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var enableViewRecyclingCache: Boolean? = null
private var enableViewRecyclingForTextCache: Boolean? = null
private var enableViewRecyclingForViewCache: Boolean? = null
private var excludeYogaFromRawPropsCache: Boolean? = null
private var fixDifferentiatorEmittingUpdatesWithWrongParentTagCache: Boolean? = null
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
private var fixMountingCoordinatorReportedPendingTransactionsOnAndroidCache: Boolean? = null
@@ -307,16 +306,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}
override fun excludeYogaFromRawProps(): Boolean {
var cached = excludeYogaFromRawPropsCache
if (cached == null) {
cached = currentProvider.excludeYogaFromRawProps()
accessedFeatureFlags.add("excludeYogaFromRawProps")
excludeYogaFromRawPropsCache = cached
}
return cached
}
override fun fixDifferentiatorEmittingUpdatesWithWrongParentTag(): Boolean {
var cached = fixDifferentiatorEmittingUpdatesWithWrongParentTagCache
if (cached == null) {
@@ -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<<9437aa04a250507b66bee88bd09a20eb>>
* @generated SignedSource<<2f2bbf0a92c3af728de6ea38dc374b94>>
*/
/**
@@ -71,8 +71,6 @@ public interface ReactNativeFeatureFlagsProvider {
@DoNotStrip public fun enableViewRecyclingForView(): Boolean
@DoNotStrip public fun excludeYogaFromRawProps(): Boolean
@DoNotStrip public fun fixDifferentiatorEmittingUpdatesWithWrongParentTag(): Boolean
@DoNotStrip public fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean
@@ -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<<438925ebf728d365d208367b72de2135>>
* @generated SignedSource<<14c3186a1395a23befb73fc9da972de7>>
*/
/**
@@ -183,12 +183,6 @@ class ReactNativeFeatureFlagsProviderHolder
return method(javaProvider_);
}
bool excludeYogaFromRawProps() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("excludeYogaFromRawProps");
return method(javaProvider_);
}
bool fixDifferentiatorEmittingUpdatesWithWrongParentTag() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("fixDifferentiatorEmittingUpdatesWithWrongParentTag");
@@ -415,11 +409,6 @@ bool JReactNativeFeatureFlagsCxxInterop::enableViewRecyclingForView(
return ReactNativeFeatureFlags::enableViewRecyclingForView();
}
bool JReactNativeFeatureFlagsCxxInterop::excludeYogaFromRawProps(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::excludeYogaFromRawProps();
}
bool JReactNativeFeatureFlagsCxxInterop::fixDifferentiatorEmittingUpdatesWithWrongParentTag(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::fixDifferentiatorEmittingUpdatesWithWrongParentTag();
@@ -608,9 +597,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"enableViewRecyclingForView",
JReactNativeFeatureFlagsCxxInterop::enableViewRecyclingForView),
makeNativeMethod(
"excludeYogaFromRawProps",
JReactNativeFeatureFlagsCxxInterop::excludeYogaFromRawProps),
makeNativeMethod(
"fixDifferentiatorEmittingUpdatesWithWrongParentTag",
JReactNativeFeatureFlagsCxxInterop::fixDifferentiatorEmittingUpdatesWithWrongParentTag),
@@ -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<<d6cf1ed76520eaba054154df329b383b>>
* @generated SignedSource<<5edcb3baccc7a27525ba6ca43b2aab8a>>
*/
/**
@@ -102,9 +102,6 @@ class JReactNativeFeatureFlagsCxxInterop
static bool enableViewRecyclingForView(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool excludeYogaFromRawProps(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool fixDifferentiatorEmittingUpdatesWithWrongParentTag(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
@@ -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<<d4a76af56d22ff7a1d6e9bc4626cd2fc>>
* @generated SignedSource<<98c62bb40ef9c03af6e3e2d758cef7ec>>
*/
/**
@@ -122,10 +122,6 @@ bool ReactNativeFeatureFlags::enableViewRecyclingForView() {
return getAccessor().enableViewRecyclingForView();
}
bool ReactNativeFeatureFlags::excludeYogaFromRawProps() {
return getAccessor().excludeYogaFromRawProps();
}
bool ReactNativeFeatureFlags::fixDifferentiatorEmittingUpdatesWithWrongParentTag() {
return getAccessor().fixDifferentiatorEmittingUpdatesWithWrongParentTag();
}
@@ -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<<4b900e66889d8f2effc015e24ccaf929>>
* @generated SignedSource<<452dc78526d49a23c5052bd1ecd130d2>>
*/
/**
@@ -159,11 +159,6 @@ class ReactNativeFeatureFlags {
*/
RN_EXPORT static bool enableViewRecyclingForView();
/**
* When enabled, rawProps in Props will not include Yoga specific props.
*/
RN_EXPORT static bool excludeYogaFromRawProps();
/**
* Fixes a bug in Differentiator where parent views may be referenced before they're created
*/
@@ -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<<7f13688e9deae01bb9a66f3b037ed56a>>
* @generated SignedSource<<dd3a65bc7f16b0d774237c21c21d048a>>
*/
/**
@@ -461,24 +461,6 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecyclingForView() {
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::excludeYogaFromRawProps() {
auto flagValue = excludeYogaFromRawProps_.load();
if (!flagValue.has_value()) {
// This block is not exclusive but it is not necessary.
// If multiple threads try to initialize the feature flag, we would only
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(24, "excludeYogaFromRawProps");
flagValue = currentProvider_->excludeYogaFromRawProps();
excludeYogaFromRawProps_ = flagValue;
}
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::fixDifferentiatorEmittingUpdatesWithWrongParentTag() {
auto flagValue = fixDifferentiatorEmittingUpdatesWithWrongParentTag_.load();
@@ -488,7 +470,7 @@ bool ReactNativeFeatureFlagsAccessor::fixDifferentiatorEmittingUpdatesWithWrongP
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(25, "fixDifferentiatorEmittingUpdatesWithWrongParentTag");
markFlagAsAccessed(24, "fixDifferentiatorEmittingUpdatesWithWrongParentTag");
flagValue = currentProvider_->fixDifferentiatorEmittingUpdatesWithWrongParentTag();
fixDifferentiatorEmittingUpdatesWithWrongParentTag_ = flagValue;
@@ -506,7 +488,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMappingOfEventPrioritiesBetweenFabricAn
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(26, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
markFlagAsAccessed(25, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
flagValue = currentProvider_->fixMappingOfEventPrioritiesBetweenFabricAndReact();
fixMappingOfEventPrioritiesBetweenFabricAndReact_ = flagValue;
@@ -524,7 +506,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMountingCoordinatorReportedPendingTrans
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(27, "fixMountingCoordinatorReportedPendingTransactionsOnAndroid");
markFlagAsAccessed(26, "fixMountingCoordinatorReportedPendingTransactionsOnAndroid");
flagValue = currentProvider_->fixMountingCoordinatorReportedPendingTransactionsOnAndroid();
fixMountingCoordinatorReportedPendingTransactionsOnAndroid_ = flagValue;
@@ -542,7 +524,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxEnabledRelease() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(28, "fuseboxEnabledRelease");
markFlagAsAccessed(27, "fuseboxEnabledRelease");
flagValue = currentProvider_->fuseboxEnabledRelease();
fuseboxEnabledRelease_ = flagValue;
@@ -560,7 +542,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxNetworkInspectionEnabled() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(29, "fuseboxNetworkInspectionEnabled");
markFlagAsAccessed(28, "fuseboxNetworkInspectionEnabled");
flagValue = currentProvider_->fuseboxNetworkInspectionEnabled();
fuseboxNetworkInspectionEnabled_ = flagValue;
@@ -578,7 +560,7 @@ bool ReactNativeFeatureFlagsAccessor::lazyAnimationCallbacks() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(30, "lazyAnimationCallbacks");
markFlagAsAccessed(29, "lazyAnimationCallbacks");
flagValue = currentProvider_->lazyAnimationCallbacks();
lazyAnimationCallbacks_ = flagValue;
@@ -596,7 +578,7 @@ bool ReactNativeFeatureFlagsAccessor::removeTurboModuleManagerDelegateMutex() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(31, "removeTurboModuleManagerDelegateMutex");
markFlagAsAccessed(30, "removeTurboModuleManagerDelegateMutex");
flagValue = currentProvider_->removeTurboModuleManagerDelegateMutex();
removeTurboModuleManagerDelegateMutex_ = flagValue;
@@ -614,7 +596,7 @@ bool ReactNativeFeatureFlagsAccessor::throwExceptionInsteadOfDeadlockOnTurboModu
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(32, "throwExceptionInsteadOfDeadlockOnTurboModuleSetupDuringSyncRenderIOS");
markFlagAsAccessed(31, "throwExceptionInsteadOfDeadlockOnTurboModuleSetupDuringSyncRenderIOS");
flagValue = currentProvider_->throwExceptionInsteadOfDeadlockOnTurboModuleSetupDuringSyncRenderIOS();
throwExceptionInsteadOfDeadlockOnTurboModuleSetupDuringSyncRenderIOS_ = flagValue;
@@ -632,7 +614,7 @@ bool ReactNativeFeatureFlagsAccessor::traceTurboModulePromiseRejectionsOnAndroid
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(33, "traceTurboModulePromiseRejectionsOnAndroid");
markFlagAsAccessed(32, "traceTurboModulePromiseRejectionsOnAndroid");
flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid();
traceTurboModulePromiseRejectionsOnAndroid_ = flagValue;
@@ -650,7 +632,7 @@ bool ReactNativeFeatureFlagsAccessor::useAlwaysAvailableJSErrorHandling() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(34, "useAlwaysAvailableJSErrorHandling");
markFlagAsAccessed(33, "useAlwaysAvailableJSErrorHandling");
flagValue = currentProvider_->useAlwaysAvailableJSErrorHandling();
useAlwaysAvailableJSErrorHandling_ = flagValue;
@@ -668,7 +650,7 @@ bool ReactNativeFeatureFlagsAccessor::useEditTextStockAndroidFocusBehavior() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(35, "useEditTextStockAndroidFocusBehavior");
markFlagAsAccessed(34, "useEditTextStockAndroidFocusBehavior");
flagValue = currentProvider_->useEditTextStockAndroidFocusBehavior();
useEditTextStockAndroidFocusBehavior_ = flagValue;
@@ -686,7 +668,7 @@ bool ReactNativeFeatureFlagsAccessor::useFabricInterop() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(36, "useFabricInterop");
markFlagAsAccessed(35, "useFabricInterop");
flagValue = currentProvider_->useFabricInterop();
useFabricInterop_ = flagValue;
@@ -704,7 +686,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeViewConfigsInBridgelessMode() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(37, "useNativeViewConfigsInBridgelessMode");
markFlagAsAccessed(36, "useNativeViewConfigsInBridgelessMode");
flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode();
useNativeViewConfigsInBridgelessMode_ = flagValue;
@@ -722,7 +704,7 @@ bool ReactNativeFeatureFlagsAccessor::useOptimizedEventBatchingOnAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(38, "useOptimizedEventBatchingOnAndroid");
markFlagAsAccessed(37, "useOptimizedEventBatchingOnAndroid");
flagValue = currentProvider_->useOptimizedEventBatchingOnAndroid();
useOptimizedEventBatchingOnAndroid_ = flagValue;
@@ -740,7 +722,7 @@ bool ReactNativeFeatureFlagsAccessor::useRawPropsJsiValue() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(39, "useRawPropsJsiValue");
markFlagAsAccessed(38, "useRawPropsJsiValue");
flagValue = currentProvider_->useRawPropsJsiValue();
useRawPropsJsiValue_ = flagValue;
@@ -758,7 +740,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModuleInterop() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(40, "useTurboModuleInterop");
markFlagAsAccessed(39, "useTurboModuleInterop");
flagValue = currentProvider_->useTurboModuleInterop();
useTurboModuleInterop_ = flagValue;
@@ -776,7 +758,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModules() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(41, "useTurboModules");
markFlagAsAccessed(40, "useTurboModules");
flagValue = currentProvider_->useTurboModules();
useTurboModules_ = flagValue;
@@ -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<<4e1004375c9baf18799712865c345be5>>
* @generated SignedSource<<c526b54707d066c3883f5209b597ec83>>
*/
/**
@@ -56,7 +56,6 @@ class ReactNativeFeatureFlagsAccessor {
bool enableViewRecycling();
bool enableViewRecyclingForText();
bool enableViewRecyclingForView();
bool excludeYogaFromRawProps();
bool fixDifferentiatorEmittingUpdatesWithWrongParentTag();
bool fixMappingOfEventPrioritiesBetweenFabricAndReact();
bool fixMountingCoordinatorReportedPendingTransactionsOnAndroid();
@@ -85,7 +84,7 @@ class ReactNativeFeatureFlagsAccessor {
std::unique_ptr<ReactNativeFeatureFlagsProvider> currentProvider_;
bool wasOverridden_;
std::array<std::atomic<const char*>, 42> accessedFeatureFlags_;
std::array<std::atomic<const char*>, 41> accessedFeatureFlags_;
std::atomic<std::optional<bool>> commonTestFlag_;
std::atomic<std::optional<bool>> disableMountItemReorderingAndroid_;
@@ -111,7 +110,6 @@ class ReactNativeFeatureFlagsAccessor {
std::atomic<std::optional<bool>> enableViewRecycling_;
std::atomic<std::optional<bool>> enableViewRecyclingForText_;
std::atomic<std::optional<bool>> enableViewRecyclingForView_;
std::atomic<std::optional<bool>> excludeYogaFromRawProps_;
std::atomic<std::optional<bool>> fixDifferentiatorEmittingUpdatesWithWrongParentTag_;
std::atomic<std::optional<bool>> fixMappingOfEventPrioritiesBetweenFabricAndReact_;
std::atomic<std::optional<bool>> fixMountingCoordinatorReportedPendingTransactionsOnAndroid_;
@@ -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<<8a8ab98861bae26f9b560a91cbb81626>>
* @generated SignedSource<<132471a831b3041cc6cae8915de33982>>
*/
/**
@@ -123,10 +123,6 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
return true;
}
bool excludeYogaFromRawProps() override {
return false;
}
bool fixDifferentiatorEmittingUpdatesWithWrongParentTag() override {
return true;
}
@@ -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<<52f682b1103d4ff9444da86525f088bb>>
* @generated SignedSource<<b4b4f1a34fa94b88dae41b0f14c96cc8>>
*/
/**
@@ -261,15 +261,6 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef
return ReactNativeFeatureFlagsDefaults::enableViewRecyclingForView();
}
bool excludeYogaFromRawProps() override {
auto value = values_["excludeYogaFromRawProps"];
if (!value.isNull()) {
return value.getBool();
}
return ReactNativeFeatureFlagsDefaults::excludeYogaFromRawProps();
}
bool fixDifferentiatorEmittingUpdatesWithWrongParentTag() override {
auto value = values_["fixDifferentiatorEmittingUpdatesWithWrongParentTag"];
if (!value.isNull()) {
@@ -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<<825e61e4b94a95c4700a52a1d9cadb74>>
* @generated SignedSource<<7bd8ef01ed492807df85a3d4a7f6a55c>>
*/
/**
@@ -98,8 +98,6 @@ class ReactNativeFeatureFlagsOverridesOSSCanary : public ReactNativeFeatureFlags
@@ -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<<ddf338308d0390152ddbec172c0ad40e>>
* @generated SignedSource<<25f75edcfc62e5ce24c2d1bd10244e40>>
*/
/**
@@ -105,8 +105,6 @@ class ReactNativeFeatureFlagsOverridesOSSExperimental : public ReactNativeFeatur
@@ -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<<dc7831b43906e724bbfe5453fdff9199>>
* @generated SignedSource<<abf61ee3c9ef2363a04899dda2920fdc>>
*/
/**
@@ -49,7 +49,6 @@ class ReactNativeFeatureFlagsProvider {
virtual bool enableViewRecycling() = 0;
virtual bool enableViewRecyclingForText() = 0;
virtual bool enableViewRecyclingForView() = 0;
virtual bool excludeYogaFromRawProps() = 0;
virtual bool fixDifferentiatorEmittingUpdatesWithWrongParentTag() = 0;
virtual bool fixMappingOfEventPrioritiesBetweenFabricAndReact() = 0;
virtual bool fixMountingCoordinatorReportedPendingTransactionsOnAndroid() = 0;
@@ -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<<f020431a9ced870c17f90701d776b689>>
* @generated SignedSource<<2e88c46eee92923e11e44bc63a297f91>>
*/
/**
@@ -164,11 +164,6 @@ bool NativeReactNativeFeatureFlags::enableViewRecyclingForView(
return ReactNativeFeatureFlags::enableViewRecyclingForView();
}
bool NativeReactNativeFeatureFlags::excludeYogaFromRawProps(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::excludeYogaFromRawProps();
}
bool NativeReactNativeFeatureFlags::fixDifferentiatorEmittingUpdatesWithWrongParentTag(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::fixDifferentiatorEmittingUpdatesWithWrongParentTag();
@@ -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<<1a82faa89018f5722a57fe5098b69324>>
* @generated SignedSource<<976dc1d9e9df5d843d796ba71fab2e27>>
*/
/**
@@ -85,8 +85,6 @@ class NativeReactNativeFeatureFlags
bool enableViewRecyclingForView(jsi::Runtime& runtime);
bool excludeYogaFromRawProps(jsi::Runtime& runtime);
bool fixDifferentiatorEmittingUpdatesWithWrongParentTag(jsi::Runtime& runtime);
bool fixMappingOfEventPrioritiesBetweenFabricAndReact(jsi::Runtime& runtime);
@@ -25,8 +25,6 @@
namespace facebook::react {
static_assert(RawPropsFilterable<YogaLayoutableShadowNode>);
static int FabricDefaultYogaLog(
const YGConfigConstRef /*unused*/,
const YGNodeConstRef /*unused*/,
@@ -785,13 +783,6 @@ Rect YogaLayoutableShadowNode::getContentBounds() const {
return contentBounds;
}
/*static*/ void YogaLayoutableShadowNode::filterRawProps(RawProps& rawProps) {
if (ReactNativeFeatureFlags::excludeYogaFromRawProps()) {
// TODO: this shouldn't live in RawProps
rawProps.filterYogaStylePropsInDynamicConversion();
}
}
#pragma mark - Yoga Connectors
YGNodeRef YogaLayoutableShadowNode::yogaNodeCloneCallbackConnector(
@@ -85,8 +85,6 @@ class YogaLayoutableShadowNode : public LayoutableShadowNode {
Rect getContentBounds() const;
static void filterRawProps(RawProps& rawProps);
protected:
/*
* Yoga config associated (only) with this particular node.
@@ -14,96 +14,6 @@
namespace facebook::react {
namespace {
inline bool isYogaStyleProp(const std::string& prop) {
const static std::unordered_set<std::string> yogaStylePropNames = {
{"direction",
"flexDirection",
"justifyContent",
"alignContent",
"alignItems",
"alignSelf",
"position",
"flexWrap",
"display",
"flex",
"flexGrow",
"flexShrink",
"flexBasis",
"margin",
"padding",
"rowGap",
"columnGap",
"gap",
// TODO: T163711275 also filter out width/height when SVG no longer read
// them from RawProps
"minWidth",
"maxWidth",
"minHeight",
"maxHeight",
"aspectRatio",
// edges
"left",
"right",
"top",
"bottom",
"start",
"end",
// variants of inset
"inset",
"insetStart",
"insetEnd",
"insetInline",
"insetInlineStart",
"insetInlineEnd",
"insetBlock",
"insetBlockEnd",
"insetBlockStart",
"insetVertical",
"insetHorizontal",
"insetTop",
"insetBottom",
"insetLeft",
"insetRight",
// variants of margin
"marginStart",
"marginEnd",
"marginInline",
"marginInlineStart",
"marginInlineEnd",
"marginBlock",
"marginBlockStart",
"marginBlockEnd",
"marginVertical",
"marginHorizontal",
"marginTop",
"marginBottom",
"marginLeft",
"marginRight",
// variants of padding
"paddingStart",
"paddingEnd",
"paddingInline",
"paddingInlineStart",
"paddingInlineEnd",
"paddingBlock",
"paddingBlockStart",
"paddingBlockEnd",
"paddingVertical",
"paddingHorizontal",
"paddingTop",
"paddingBottom",
"paddingLeft",
"paddingRight"}};
return yogaStylePropNames.find(prop) != yogaStylePropNames.end();
}
} // namespace
/*
* Creates an object with given `runtime` and `value`.
*/
@@ -142,7 +52,6 @@ RawProps::RawProps(const RawProps& other) noexcept {
} else if (mode_ == Mode::Dynamic) {
dynamic_ = other.dynamic_;
}
ignoreYogaStyleProps_ = other.ignoreYogaStyleProps_;
}
void RawProps::parse(const RawPropsParser& parser) noexcept {
@@ -171,13 +80,10 @@ folly::dynamic RawProps::toDynamic(
case Mode::Empty:
return folly::dynamic::object();
case Mode::JSI: {
if (ignoreYogaStyleProps_ || filterObjectKeys != nullptr) {
if (filterObjectKeys != nullptr) {
// We need to filter props
return jsi::dynamicFromValue(
*runtime_, value_, [&](const std::string& key) {
if (ignoreYogaStyleProps_ && isYogaStyleProp(key)) {
return true;
}
if (filterObjectKeys) {
return filterObjectKeys(key);
}
@@ -193,10 +99,6 @@ folly::dynamic RawProps::toDynamic(
}
}
void RawProps::filterYogaStylePropsInDynamicConversion() noexcept {
ignoreYogaStyleProps_ = true;
}
/*
* Returns `true` if the object is empty.
* Empty `RawProps` does not have any stored data.
@@ -82,15 +82,6 @@ class RawProps final {
const std::function<bool(const std::string&)>& filterObjectKeys =
nullptr) const;
/*
* Once called, Yoga style props will be filtered out during conversion to
* folly::dynamic. folly::dynamic conversion is only used on Android and props
* specific to Yoga do not need to be send over JNI to Android.
* This is a performance optimisation to minimise traffic between C++ and
* Java.
*/
void filterYogaStylePropsInDynamicConversion() noexcept;
/*
* Returns `true` if the object is empty.
* Empty `RawProps` does not have any stored data.
@@ -135,8 +126,6 @@ class RawProps final {
*/
mutable std::vector<RawPropsValueIndex> keyIndexToValueIndex_;
mutable std::vector<RawValue> values_;
bool ignoreYogaStyleProps_{false};
};
/*
@@ -464,39 +464,3 @@ TEST(RawPropsTest, copyJSIRawProps) {
EXPECT_NEAR(
copyProps->derivedFloatValue, originalProps->derivedFloatValue, 0.00001);
}
TEST(RawPropsTest, filterYogaRawProps) {
auto runtime = facebook::hermes::makeHermesRuntime();
ContextContainer contextContainer{};
PropsParserContext parserContext{-1, contextContainer};
auto object = jsi::Object(*runtime);
object.setProperty(*runtime, "floatValue", 10.0);
object.setProperty(*runtime, "flex", 1);
auto rawProps = RawProps(*runtime, jsi::Value(*runtime, object));
EXPECT_FALSE(rawProps.isEmpty());
auto dynamicProps = (folly::dynamic)rawProps;
EXPECT_EQ(dynamicProps["floatValue"], 10.0);
EXPECT_EQ(dynamicProps["flex"], 1);
rawProps.filterYogaStylePropsInDynamicConversion();
dynamicProps = (folly::dynamic)rawProps;
EXPECT_EQ(dynamicProps["floatValue"], 10.0);
EXPECT_EQ(dynamicProps["flex"], nullptr);
// The fact that filterYogaStylePropsInDynamicConversion should
// must apply to a copy as well.
auto copy = RawProps(rawProps);
auto dynamicPropsFromCopy = (folly::dynamic)copy;
EXPECT_EQ(dynamicPropsFromCopy["floatValue"], 10.0);
EXPECT_EQ(dynamicPropsFromCopy["flex"], nullptr);
}
@@ -301,17 +301,6 @@ const definitions: FeatureFlagDefinitions = {
},
ossReleaseStage: 'none',
},
excludeYogaFromRawProps: {
defaultValue: false,
metadata: {
dateAdded: '2024-07-22',
description:
'When enabled, rawProps in Props will not include Yoga specific props.',
expectedReleaseValue: true,
purpose: 'experimentation',
},
ossReleaseStage: 'none',
},
fixDifferentiatorEmittingUpdatesWithWrongParentTag: {
defaultValue: true,
metadata: {
@@ -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<<28bf0120b44887b9cf23eeca6afdd945>>
* @generated SignedSource<<4f1befe0cec24eeb531d7ecca6bc451b>>
* @flow strict
*/
@@ -72,7 +72,6 @@ export type ReactNativeFeatureFlags = $ReadOnly<{
enableViewRecycling: Getter<boolean>,
enableViewRecyclingForText: Getter<boolean>,
enableViewRecyclingForView: Getter<boolean>,
excludeYogaFromRawProps: Getter<boolean>,
fixDifferentiatorEmittingUpdatesWithWrongParentTag: Getter<boolean>,
fixMappingOfEventPrioritiesBetweenFabricAndReact: Getter<boolean>,
fixMountingCoordinatorReportedPendingTransactionsOnAndroid: Getter<boolean>,
@@ -262,10 +261,6 @@ export const enableViewRecyclingForText: Getter<boolean> = createNativeFlagGette
* Enables View Recycling for <View> via ReactViewGroup/ReactViewManager.
*/
export const enableViewRecyclingForView: Getter<boolean> = createNativeFlagGetter('enableViewRecyclingForView', true);
/**
* When enabled, rawProps in Props will not include Yoga specific props.
*/
export const excludeYogaFromRawProps: Getter<boolean> = createNativeFlagGetter('excludeYogaFromRawProps', false);
/**
* Fixes a bug in Differentiator where parent views may be referenced before they're created
*/
@@ -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<<ab96527a0c628514632de35f7315f919>>
* @generated SignedSource<<f8e0c44bed98b686fd2964aae598ad67>>
* @flow strict
*/
@@ -48,7 +48,6 @@ export interface Spec extends TurboModule {
+enableViewRecycling?: () => boolean;
+enableViewRecyclingForText?: () => boolean;
+enableViewRecyclingForView?: () => boolean;
+excludeYogaFromRawProps?: () => boolean;
+fixDifferentiatorEmittingUpdatesWithWrongParentTag?: () => boolean;
+fixMappingOfEventPrioritiesBetweenFabricAndReact?: () => boolean;
+fixMountingCoordinatorReportedPendingTransactionsOnAndroid?: () => boolean;