Skip to content

Commit

Permalink
Migrate excludeYogaFromRawProps to ReactNativeFeatureFlags (#45586)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #45586

Migrate excludeYogaFromRawProps to ReactNativeFeatureFlags

changelog: [internal] internal

Reviewed By: NickGerleman

Differential Revision: D60022939

fbshipit-source-id: 150ecc98aa3323d5adea3a41a3d91d404c99e5a7
  • Loading branch information
mdvacca authored and facebook-github-bot committed Jul 22, 2024
1 parent 4d77c35 commit 700b403
Show file tree
Hide file tree
Showing 22 changed files with 140 additions and 42 deletions.
1 change: 0 additions & 1 deletion packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -1969,7 +1969,6 @@ public class com/facebook/react/config/ReactFeatureFlags {
public static field enableFabricLogs Z
public static field enableFabricRenderer Z
public static field enableViewRecycling Z
public static field excludeYogaFromRawProps Z
public static field traceTurboModulePromiseRejections Z
public static field unstable_enableTurboModuleSyncVoidMethods Z
public static field unstable_useFabricInterop Z
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ public class ReactFeatureFlags {
*/
public static boolean enableCppPropsIteratorSetter = false;

/** When enabled, rawProps in Props will not include Yoga specific props. */
public static boolean excludeYogaFromRawProps = false;

/**
* Enables storing js caller stack when creating promise in native module. This is useful in case
* of Promise rejection and tracing the cause.
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<<74d986b082e44be1b358d5442f4d133d>>
* @generated SignedSource<<0a9e1aa23c685e58456bb80f8ee9ef10>>
*/

/**
Expand Down Expand Up @@ -124,6 +124,12 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun enableUIConsistency(): Boolean = accessor.enableUIConsistency()

/**
* When enabled, rawProps in Props will not include Yoga specific props.
*/
@JvmStatic
public fun excludeYogaFromRawProps(): Boolean = accessor.excludeYogaFromRawProps()

/**
* Start image fetching during view preallocation instead of waiting for layout pass
*/
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<<375e752a672912488b52e34f39b5ed8c>>
* @generated SignedSource<<d201dcea30257e1fe545f0c795f4127a>>
*/

/**
Expand Down Expand Up @@ -36,6 +36,7 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
private var enablePropsUpdateReconciliationAndroidCache: Boolean? = null
private var enableSynchronousStateUpdatesCache: Boolean? = null
private var enableUIConsistencyCache: Boolean? = null
private var excludeYogaFromRawPropsCache: Boolean? = null
private var fetchImagesInViewPreallocationCache: Boolean? = null
private var fixIncorrectScrollViewStateUpdateOnAndroidCache: Boolean? = null
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
Expand Down Expand Up @@ -199,6 +200,15 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
return cached
}

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

override fun fetchImagesInViewPreallocation(): Boolean {
var cached = fetchImagesInViewPreallocationCache
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<<143e35723bffbb6ba5be2cfa4a497f0b>>
* @generated SignedSource<<6e715e118c8e41d7a4b3a8ce02c62d4d>>
*/

/**
Expand Down Expand Up @@ -60,6 +60,8 @@ public object ReactNativeFeatureFlagsCxxInterop {

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

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

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

@DoNotStrip @JvmStatic public external fun fixIncorrectScrollViewStateUpdateOnAndroid(): 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<<841edbe102ebbd78040892cf76f79bba>>
* @generated SignedSource<<6763616cc6266115d83a59f2aa957662>>
*/

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

override fun enableUIConsistency(): Boolean = false

override fun excludeYogaFromRawProps(): Boolean = false

override fun fetchImagesInViewPreallocation(): Boolean = false

override fun fixIncorrectScrollViewStateUpdateOnAndroid(): Boolean = 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<<58cd9d65067ed758ecad65ad22737b6c>>
* @generated SignedSource<<0a1e1cdc3861ba113ce05a80f989fdc5>>
*/

/**
Expand Down Expand Up @@ -40,6 +40,7 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
private var enablePropsUpdateReconciliationAndroidCache: Boolean? = null
private var enableSynchronousStateUpdatesCache: Boolean? = null
private var enableUIConsistencyCache: Boolean? = null
private var excludeYogaFromRawPropsCache: Boolean? = null
private var fetchImagesInViewPreallocationCache: Boolean? = null
private var fixIncorrectScrollViewStateUpdateOnAndroidCache: Boolean? = null
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
Expand Down Expand Up @@ -219,6 +220,16 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
return cached
}

override fun excludeYogaFromRawProps(): Boolean {
var cached = excludeYogaFromRawPropsCache
if (cached == null) {
cached = currentProvider.excludeYogaFromRawProps()
accessedFeatureFlags.add("excludeYogaFromRawProps")
excludeYogaFromRawPropsCache = cached
}
return cached
}

override fun fetchImagesInViewPreallocation(): Boolean {
var cached = fetchImagesInViewPreallocationCache
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<<7f753a763c3f4c0bcbdad268e32b21fb>>
* @generated SignedSource<<9eef72f825f596873e59e4fe8c00fdbe>>
*/

/**
Expand Down Expand Up @@ -55,6 +55,8 @@ public interface ReactNativeFeatureFlagsProvider {

@DoNotStrip public fun enableUIConsistency(): Boolean

@DoNotStrip public fun excludeYogaFromRawProps(): Boolean

@DoNotStrip public fun fetchImagesInViewPreallocation(): Boolean

@DoNotStrip public fun fixIncorrectScrollViewStateUpdateOnAndroid(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ void Binding::installFabricUIManager(
CoreFeatures::enablePropIteratorSetter =
getFeatureFlagValue("enableCppPropsIteratorSetter");
CoreFeatures::excludeYogaFromRawProps =
getFeatureFlagValue("excludeYogaFromRawProps");
ReactNativeFeatureFlags::excludeYogaFromRawProps();

auto toolbox = SchedulerToolbox{};
toolbox.contextContainer = contextContainer;
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<<d6b1fc3721972fd7f9286bf6140d46e7>>
* @generated SignedSource<<071a086e05e9f98555961052f70e81df>>
*/

/**
Expand Down Expand Up @@ -135,6 +135,12 @@ class ReactNativeFeatureFlagsProviderHolder
return method(javaProvider_);
}

bool excludeYogaFromRawProps() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("excludeYogaFromRawProps");
return method(javaProvider_);
}

bool fetchImagesInViewPreallocation() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("fetchImagesInViewPreallocation");
Expand Down Expand Up @@ -327,6 +333,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableUIConsistency(
return ReactNativeFeatureFlags::enableUIConsistency();
}

bool JReactNativeFeatureFlagsCxxInterop::excludeYogaFromRawProps(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::excludeYogaFromRawProps();
}

bool JReactNativeFeatureFlagsCxxInterop::fetchImagesInViewPreallocation(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::fetchImagesInViewPreallocation();
Expand Down Expand Up @@ -482,6 +493,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"enableUIConsistency",
JReactNativeFeatureFlagsCxxInterop::enableUIConsistency),
makeNativeMethod(
"excludeYogaFromRawProps",
JReactNativeFeatureFlagsCxxInterop::excludeYogaFromRawProps),
makeNativeMethod(
"fetchImagesInViewPreallocation",
JReactNativeFeatureFlagsCxxInterop::fetchImagesInViewPreallocation),
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<<e55e568ed63f298253d863935068197a>>
* @generated SignedSource<<f5a5eac6a144b6d60e56641f67c7b09c>>
*/

/**
Expand Down Expand Up @@ -78,6 +78,9 @@ class JReactNativeFeatureFlagsCxxInterop
static bool enableUIConsistency(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static bool excludeYogaFromRawProps(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static bool fetchImagesInViewPreallocation(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

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<<ce67d7e79b3aceb449ee3b178f4e425b>>
* @generated SignedSource<<9018edcc813f79df51c2417214b428c0>>
*/

/**
Expand Down Expand Up @@ -85,6 +85,10 @@ bool ReactNativeFeatureFlags::enableUIConsistency() {
return getAccessor().enableUIConsistency();
}

bool ReactNativeFeatureFlags::excludeYogaFromRawProps() {
return getAccessor().excludeYogaFromRawProps();
}

bool ReactNativeFeatureFlags::fetchImagesInViewPreallocation() {
return getAccessor().fetchImagesInViewPreallocation();
}
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<<9a8e9432a444aaa9d997a91a77e17fa9>>
* @generated SignedSource<<b7ca52cd4fe82dcbc65f071a0792a885>>
*/

/**
Expand Down Expand Up @@ -117,6 +117,11 @@ class ReactNativeFeatureFlags {
*/
RN_EXPORT static bool enableUIConsistency();

/**
* When enabled, rawProps in Props will not include Yoga specific props.
*/
RN_EXPORT static bool excludeYogaFromRawProps();

/**
* Start image fetching during view preallocation instead of waiting for layout pass
*/
Expand Down
Loading

0 comments on commit 700b403

Please sign in to comment.