Skip to content

Commit

Permalink
Migrate enableCppPropsIteratorSetter to ReactNativeFeatureFlags
Browse files Browse the repository at this point in the history
Summary:
Migrate enableCppPropsIteratorSetter to ReactNativeFeatureFlags

changelog: [internal] internal

Differential Revision: D60022936
  • Loading branch information
mdvacca committed Oct 23, 2024
1 parent aadb1d9 commit b8f53ad
Show file tree
Hide file tree
Showing 36 changed files with 609 additions and 486 deletions.
4 changes: 0 additions & 4 deletions packages/react-native/React/Fabric/RCTSurfacePresenter.mm
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,6 @@ - (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;
}

auto componentRegistryFactory =
[factory = wrapManagedObject(_mountingManager.componentViewRegistry.componentViewFactory)](
const EventDispatcher::Weak &eventDispatcher, const ContextContainer::Shared &contextContainer) {
Expand Down
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 @@ -2044,7 +2044,6 @@ public final class com/facebook/react/common/network/OkHttpCallUtil {

public class com/facebook/react/config/ReactFeatureFlags {
public static field dispatchPointerEvents Z
public static field enableCppPropsIteratorSetter Z
public fun <init> ()V
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,4 @@
public class ReactFeatureFlags {

public static boolean dispatchPointerEvents = false;

/**
* Enable prop iterator setter-style construction of Props in C++ (this flag is not used in Java).
*/
public static boolean enableCppPropsIteratorSetter = false;
}
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<<6eb9ba14445c1ce6b54a690941171485>>
* @generated SignedSource<<f98a6ddd268fb59b5ee5edb4997b3a63>>
*/

/**
Expand Down Expand Up @@ -76,6 +76,12 @@ 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()

/**
* Deletes views that were pre-allocated but never mounted on the screen.
*/
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<<f88e475c51f2595d8ead29ff66e84da1>>
* @generated SignedSource<<6b3d3512d88c836dd809204cad636211>>
*/

/**
Expand All @@ -28,6 +28,7 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
private var enableAndroidLineHeightCenteringCache: Boolean? = null
private var enableBridgelessArchitectureCache: Boolean? = null
private var enableCleanTextInputYogaNodeCache: Boolean? = null
private var enableCppPropsIteratorSetterCache: Boolean? = null
private var enableDeletionOfUnmountedViewsCache: Boolean? = null
private var enableEagerRootViewAttachmentCache: Boolean? = null
private var enableEventEmitterRetentionDuringGesturesOnAndroidCache: Boolean? = null
Expand Down Expand Up @@ -139,6 +140,15 @@ 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 enableDeletionOfUnmountedViews(): Boolean {
var cached = enableDeletionOfUnmountedViewsCache
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<<a16a01bbf3c2404ed7c6fa569d68b505>>
* @generated SignedSource<<0ef9a66ccabeb0357f4b15c3e897f8fb>>
*/

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

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

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

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

@DoNotStrip @JvmStatic public external fun enableEagerRootViewAttachment(): 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<<1ce9496b005924d8a421899ce55f6d81>>
* @generated SignedSource<<ee5400241a72652a2f8ff343a06e4e8c>>
*/

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

override fun enableCleanTextInputYogaNode(): Boolean = false

override fun enableCppPropsIteratorSetter(): Boolean = false

override fun enableDeletionOfUnmountedViews(): Boolean = false

override fun enableEagerRootViewAttachment(): 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<<b6dd6a5d02c9070c3f35f70d5d1b7e35>>
* @generated SignedSource<<949f5cdf6d0a4015fbd680ba718dce6d>>
*/

/**
Expand Down Expand Up @@ -32,6 +32,7 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
private var enableAndroidLineHeightCenteringCache: Boolean? = null
private var enableBridgelessArchitectureCache: Boolean? = null
private var enableCleanTextInputYogaNodeCache: Boolean? = null
private var enableCppPropsIteratorSetterCache: Boolean? = null
private var enableDeletionOfUnmountedViewsCache: Boolean? = null
private var enableEagerRootViewAttachmentCache: Boolean? = null
private var enableEventEmitterRetentionDuringGesturesOnAndroidCache: Boolean? = null
Expand Down Expand Up @@ -151,6 +152,16 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
return cached
}

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

override fun enableDeletionOfUnmountedViews(): Boolean {
var cached = enableDeletionOfUnmountedViewsCache
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<<12dbd7afae2f6360d17df521ebc53d2f>>
* @generated SignedSource<<4e42e76c98b7434273e4f11212f0527b>>
*/

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

@DoNotStrip public fun enableCleanTextInputYogaNode(): Boolean

@DoNotStrip public fun enableCppPropsIteratorSetter(): Boolean

@DoNotStrip public fun enableDeletionOfUnmountedViews(): Boolean

@DoNotStrip public fun enableEagerRootViewAttachment(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,6 @@ FabricUIManagerBinding::getInspectorDataForInstance(
return ReadableNativeMap::newObjectCxxArgs(result);
}

constexpr static auto kReactFeatureFlagsJavaDescriptor =
"com/facebook/react/config/ReactFeatureFlags";

static bool getFeatureFlagValue(const char* name) {
static const auto reactFeatureFlagsClass =
jni::findClassStatic(kReactFeatureFlagsJavaDescriptor);
const auto field = reactFeatureFlagsClass->getStaticField<jboolean>(name);
return reactFeatureFlagsClass->getStaticFieldValue(field) != 0;
}

void FabricUIManagerBinding::setPixelDensity(float pointScaleFactor) {
pointScaleFactor_ = pointScaleFactor;
}
Expand Down Expand Up @@ -502,8 +492,6 @@ void FabricUIManagerBinding::installFabricUIManager(
// Keep reference to config object and cache some feature flags here
reactNativeConfig_ = config;

CoreFeatures::enablePropIteratorSetter =
getFeatureFlagValue("enableCppPropsIteratorSetter");
CoreFeatures::excludeYogaFromRawProps =
ReactNativeFeatureFlags::excludeYogaFromRawProps();

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<<b83cbcc992ef83cbc0a5db25a8ac0987>>
* @generated SignedSource<<732d1ea726d8a08859bd153dc767ec7a>>
*/

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

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

bool enableDeletionOfUnmountedViews() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableDeletionOfUnmountedViews");
Expand Down Expand Up @@ -359,6 +365,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableCleanTextInputYogaNode(
return ReactNativeFeatureFlags::enableCleanTextInputYogaNode();
}

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

bool JReactNativeFeatureFlagsCxxInterop::enableDeletionOfUnmountedViews(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableDeletionOfUnmountedViews();
Expand Down Expand Up @@ -604,6 +615,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"enableCleanTextInputYogaNode",
JReactNativeFeatureFlagsCxxInterop::enableCleanTextInputYogaNode),
makeNativeMethod(
"enableCppPropsIteratorSetter",
JReactNativeFeatureFlagsCxxInterop::enableCppPropsIteratorSetter),
makeNativeMethod(
"enableDeletionOfUnmountedViews",
JReactNativeFeatureFlagsCxxInterop::enableDeletionOfUnmountedViews),
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<<f7d93dbd2b21fc29bfd3c4c231d0fa79>>
* @generated SignedSource<<88fc1d08894dc2f774ed8c64b20bdaeb>>
*/

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

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

static bool enableDeletionOfUnmountedViews(
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<<2797dcc4840b0f60670760231f51d459>>
* @generated SignedSource<<e510ad161d5c9473e9f8d9b898c7d727>>
*/

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

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

bool ReactNativeFeatureFlags::enableDeletionOfUnmountedViews() {
return getAccessor().enableDeletionOfUnmountedViews();
}
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<<64ea086a7c847e822595983867cdf776>>
* @generated SignedSource<<29b98e3d5daf7ad09cdee366ef38753e>>
*/

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

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

/**
* Deletes views that were pre-allocated but never mounted on the screen.
*/
Expand Down
Loading

0 comments on commit b8f53ad

Please sign in to comment.