Skip to content

Commit efafdf3

Browse files
Bartlomiej Bloniarzfacebook-github-bot
authored andcommitted
Add enableMountingCoordinatorPullModelAndroid feature flag (#57581)
Summary: Adds the `enableMountingCoordinatorPullModelAndroid` experiment flag (default off) that gates the Android pull-model mounting migration. Config entry plus regenerated accessors only — no behavior change. ## Changelog: [Android] [Added] - Add `enableMountingCoordinatorPullModelAndroid` feature flag Reviewed By: rubennorte Differential Revision: D112309049
1 parent a32c098 commit efafdf3

20 files changed

Lines changed: 185 additions & 68 deletions

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<c5ce707ba940ef24ca6c261fd9b2baf7>>
7+
* @generated SignedSource<<2544e292c44dabe82ad82a9b08a08f08>>
88
*/
99

1010
/**
@@ -252,6 +252,12 @@ public object ReactNativeFeatureFlags {
252252
@JvmStatic
253253
public fun enableModuleArgumentNSNullConversionIOS(): Boolean = accessor.enableModuleArgumentNSNullConversionIOS()
254254

255+
/**
256+
* When enabled, Android mounts transactions with the pull model (like iOS): the commit thread no longer pulls and builds the mount batch in schedulerShouldRenderTransactions. Instead the UI thread pulls the transaction itself via a PullTransactionMountItem enqueued in the MountItemDispatcher, builds the IntBufferBatchMountItem, and applies it synchronously. Requires `enableAccumulatedUpdatesInRawPropsAndroid` to be enabled as well, since a single pull may collapse several commits into one diff and therefore needs complete accumulated rawProps; when used together with Props 2.0, also enable `enableExclusivePropsUpdateAndroid` and `enablePropsUpdateReconciliationAndroid`.
257+
*/
258+
@JvmStatic
259+
public fun enableMountingCoordinatorPullModelAndroid(): Boolean = accessor.enableMountingCoordinatorPullModelAndroid()
260+
255261
/**
256262
* Enables the MutationObserver Web API in React Native.
257263
*/

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<628ede95c745280c1ceaa73c6dc45de0>>
7+
* @generated SignedSource<<3331513151f7b17e3902cceb65aaac1e>>
88
*/
99

1010
/**
@@ -57,6 +57,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
5757
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
5858
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
5959
private var enableModuleArgumentNSNullConversionIOSCache: Boolean? = null
60+
private var enableMountingCoordinatorPullModelAndroidCache: Boolean? = null
6061
private var enableMutationObserverByDefaultCache: Boolean? = null
6162
private var enableNativeCSSParsingCache: Boolean? = null
6263
private var enablePreparedTextLayoutCache: Boolean? = null
@@ -439,6 +440,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
439440
return cached
440441
}
441442

443+
override fun enableMountingCoordinatorPullModelAndroid(): Boolean {
444+
var cached = enableMountingCoordinatorPullModelAndroidCache
445+
if (cached == null) {
446+
cached = ReactNativeFeatureFlagsCxxInterop.enableMountingCoordinatorPullModelAndroid()
447+
enableMountingCoordinatorPullModelAndroidCache = cached
448+
}
449+
return cached
450+
}
451+
442452
override fun enableMutationObserverByDefault(): Boolean {
443453
var cached = enableMutationObserverByDefaultCache
444454
if (cached == null) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<6a0e60fe118f3651dc76c895a37fbce2>>
7+
* @generated SignedSource<<71e1be630ee2897f3546ccb23db60197>>
88
*/
99

1010
/**
@@ -102,6 +102,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
102102

103103
@DoNotStrip @JvmStatic public external fun enableModuleArgumentNSNullConversionIOS(): Boolean
104104

105+
@DoNotStrip @JvmStatic public external fun enableMountingCoordinatorPullModelAndroid(): Boolean
106+
105107
@DoNotStrip @JvmStatic public external fun enableMutationObserverByDefault(): Boolean
106108

107109
@DoNotStrip @JvmStatic public external fun enableNativeCSSParsing(): Boolean

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<37e483d52d12a735e646c8ac06acb62c>>
7+
* @generated SignedSource<<cdb20f0cac81beea272ca5de1c200e98>>
88
*/
99

1010
/**
@@ -97,6 +97,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
9797

9898
override fun enableModuleArgumentNSNullConversionIOS(): Boolean = false
9999

100+
override fun enableMountingCoordinatorPullModelAndroid(): Boolean = false
101+
100102
override fun enableMutationObserverByDefault(): Boolean = false
101103

102104
override fun enableNativeCSSParsing(): Boolean = false

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<5b7a6ca47ca43f473596e35dfced16e0>>
7+
* @generated SignedSource<<1a62a0c778f72aa89ef4acea182f17c8>>
88
*/
99

1010
/**
@@ -61,6 +61,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
6161
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
6262
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
6363
private var enableModuleArgumentNSNullConversionIOSCache: Boolean? = null
64+
private var enableMountingCoordinatorPullModelAndroidCache: Boolean? = null
6465
private var enableMutationObserverByDefaultCache: Boolean? = null
6566
private var enableNativeCSSParsingCache: Boolean? = null
6667
private var enablePreparedTextLayoutCache: Boolean? = null
@@ -480,6 +481,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
480481
return cached
481482
}
482483

484+
override fun enableMountingCoordinatorPullModelAndroid(): Boolean {
485+
var cached = enableMountingCoordinatorPullModelAndroidCache
486+
if (cached == null) {
487+
cached = currentProvider.enableMountingCoordinatorPullModelAndroid()
488+
accessedFeatureFlags.add("enableMountingCoordinatorPullModelAndroid")
489+
enableMountingCoordinatorPullModelAndroidCache = cached
490+
}
491+
return cached
492+
}
493+
483494
override fun enableMutationObserverByDefault(): Boolean {
484495
var cached = enableMutationObserverByDefaultCache
485496
if (cached == null) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<ee254c53ae1b4bc03045926028e898e5>>
7+
* @generated SignedSource<<3caf8a7b3aea3b40ff888e5f7f81e90d>>
88
*/
99

1010
/**
@@ -97,6 +97,8 @@ public interface ReactNativeFeatureFlagsProvider {
9797

9898
@DoNotStrip public fun enableModuleArgumentNSNullConversionIOS(): Boolean
9999

100+
@DoNotStrip public fun enableMountingCoordinatorPullModelAndroid(): Boolean
101+
100102
@DoNotStrip public fun enableMutationObserverByDefault(): Boolean
101103

102104
@DoNotStrip public fun enableNativeCSSParsing(): Boolean

packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<41ff49e9305aa1ff144582dfcac650d0>>
7+
* @generated SignedSource<<1e6921044c4f10ecc5a5263b671772a2>>
88
*/
99

1010
/**
@@ -261,6 +261,12 @@ class ReactNativeFeatureFlagsJavaProvider
261261
return method(javaProvider_);
262262
}
263263

264+
bool enableMountingCoordinatorPullModelAndroid() override {
265+
static const auto method =
266+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableMountingCoordinatorPullModelAndroid");
267+
return method(javaProvider_);
268+
}
269+
264270
bool enableMutationObserverByDefault() override {
265271
static const auto method =
266272
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableMutationObserverByDefault");
@@ -738,6 +744,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableModuleArgumentNSNullConversionIOS
738744
return ReactNativeFeatureFlags::enableModuleArgumentNSNullConversionIOS();
739745
}
740746

747+
bool JReactNativeFeatureFlagsCxxInterop::enableMountingCoordinatorPullModelAndroid(
748+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
749+
return ReactNativeFeatureFlags::enableMountingCoordinatorPullModelAndroid();
750+
}
751+
741752
bool JReactNativeFeatureFlagsCxxInterop::enableMutationObserverByDefault(
742753
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
743754
return ReactNativeFeatureFlags::enableMutationObserverByDefault();
@@ -1120,6 +1131,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
11201131
makeNativeMethod(
11211132
"enableModuleArgumentNSNullConversionIOS",
11221133
JReactNativeFeatureFlagsCxxInterop::enableModuleArgumentNSNullConversionIOS),
1134+
makeNativeMethod(
1135+
"enableMountingCoordinatorPullModelAndroid",
1136+
JReactNativeFeatureFlagsCxxInterop::enableMountingCoordinatorPullModelAndroid),
11231137
makeNativeMethod(
11241138
"enableMutationObserverByDefault",
11251139
JReactNativeFeatureFlagsCxxInterop::enableMutationObserverByDefault),

packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<9c5bd61122f068c919c70399828585d1>>
7+
* @generated SignedSource<<28884240a4d0cedf7e1ecfaf34378f8e>>
88
*/
99

1010
/**
@@ -141,6 +141,9 @@ class JReactNativeFeatureFlagsCxxInterop
141141
static bool enableModuleArgumentNSNullConversionIOS(
142142
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
143143

144+
static bool enableMountingCoordinatorPullModelAndroid(
145+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
146+
144147
static bool enableMutationObserverByDefault(
145148
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
146149

packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<77401595559dc52e1b2b206527deb341>>
7+
* @generated SignedSource<<c7589193e853646b63d50a4431647521>>
88
*/
99

1010
/**
@@ -174,6 +174,10 @@ bool ReactNativeFeatureFlags::enableModuleArgumentNSNullConversionIOS() {
174174
return getAccessor().enableModuleArgumentNSNullConversionIOS();
175175
}
176176

177+
bool ReactNativeFeatureFlags::enableMountingCoordinatorPullModelAndroid() {
178+
return getAccessor().enableMountingCoordinatorPullModelAndroid();
179+
}
180+
177181
bool ReactNativeFeatureFlags::enableMutationObserverByDefault() {
178182
return getAccessor().enableMutationObserverByDefault();
179183
}

packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<df8968adcf11283d6745bb2e0f5f7a5b>>
7+
* @generated SignedSource<<214d05a6296f10f2a7ac67a15dc66d1c>>
88
*/
99

1010
/**
@@ -224,6 +224,11 @@ class ReactNativeFeatureFlags {
224224
*/
225225
RN_EXPORT static bool enableModuleArgumentNSNullConversionIOS();
226226

227+
/**
228+
* When enabled, Android mounts transactions with the pull model (like iOS): the commit thread no longer pulls and builds the mount batch in schedulerShouldRenderTransactions. Instead the UI thread pulls the transaction itself via a PullTransactionMountItem enqueued in the MountItemDispatcher, builds the IntBufferBatchMountItem, and applies it synchronously. Requires `enableAccumulatedUpdatesInRawPropsAndroid` to be enabled as well, since a single pull may collapse several commits into one diff and therefore needs complete accumulated rawProps; when used together with Props 2.0, also enable `enableExclusivePropsUpdateAndroid` and `enablePropsUpdateReconciliationAndroid`.
229+
*/
230+
RN_EXPORT static bool enableMountingCoordinatorPullModelAndroid();
231+
227232
/**
228233
* Enables the MutationObserver Web API in React Native.
229234
*/

0 commit comments

Comments
 (0)