Skip to content

Commit 05e720a

Browse files
rozelefacebook-github-bot
authored andcommitted
Add feature flag for universal calls to start|finishOperationBatch (facebook#49908)
Summary: Pull Request resolved: facebook#49908 There are various batching mechanisms across react-native platforms. The NativeAnimated startOperationBatch and finishOperationBatch methods are a useful way to signal that complete animation graphs are established for atomic flushes to the UI thread. Setting up this feature flag for use across non-Android React Native platforms. ## Changelog [Internal] Reviewed By: javache Differential Revision: D70827938 fbshipit-source-id: 4c4a74e9a11f75090152637d6195092f5af866a0
1 parent 91d0345 commit 05e720a

23 files changed

+199
-64
lines changed

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

+7-1
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<<e5e17b9d0c91c979f09cbdc0314f4cf2>>
7+
* @generated SignedSource<<df008a78acc9b0104c54e06849d5e9b9>>
88
*/
99

1010
/**
@@ -34,6 +34,12 @@ public object ReactNativeFeatureFlags {
3434
@JvmStatic
3535
public fun commonTestFlag(): Boolean = accessor.commonTestFlag()
3636

37+
/**
38+
* Enables start- and finishOperationBatch on any platform.
39+
*/
40+
@JvmStatic
41+
public fun animatedShouldSignalBatch(): Boolean = accessor.animatedShouldSignalBatch()
42+
3743
/**
3844
* Prevent FabricMountingManager from reordering mountitems, which may lead to invalid state on the UI thread
3945
*/

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

+11-1
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<<e567bf1ac6ec5d0381deed1245b22a3f>>
7+
* @generated SignedSource<<9813fd15c7f54d69d3de6084f733c3a6>>
88
*/
99

1010
/**
@@ -21,6 +21,7 @@ package com.facebook.react.internal.featureflags
2121

2222
internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccessor {
2323
private var commonTestFlagCache: Boolean? = null
24+
private var animatedShouldSignalBatchCache: Boolean? = null
2425
private var disableMountItemReorderingAndroidCache: Boolean? = null
2526
private var enableAccumulatedUpdatesInRawPropsAndroidCache: Boolean? = null
2627
private var enableBridgelessArchitectureCache: Boolean? = null
@@ -71,6 +72,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
7172
return cached
7273
}
7374

75+
override fun animatedShouldSignalBatch(): Boolean {
76+
var cached = animatedShouldSignalBatchCache
77+
if (cached == null) {
78+
cached = ReactNativeFeatureFlagsCxxInterop.animatedShouldSignalBatch()
79+
animatedShouldSignalBatchCache = cached
80+
}
81+
return cached
82+
}
83+
7484
override fun disableMountItemReorderingAndroid(): Boolean {
7585
var cached = disableMountItemReorderingAndroidCache
7686
if (cached == null) {

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

+3-1
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<<1e7421f38e1dd6629e42492b2c7a4ee1>>
7+
* @generated SignedSource<<06c5ef75b624d953e7a8d9297feaf816>>
88
*/
99

1010
/**
@@ -30,6 +30,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
3030

3131
@DoNotStrip @JvmStatic public external fun commonTestFlag(): Boolean
3232

33+
@DoNotStrip @JvmStatic public external fun animatedShouldSignalBatch(): Boolean
34+
3335
@DoNotStrip @JvmStatic public external fun disableMountItemReorderingAndroid(): Boolean
3436

3537
@DoNotStrip @JvmStatic public external fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean

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

+3-1
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<<0f22538afea52085aaf605e8608eaff8>>
7+
* @generated SignedSource<<cbe1d77424b561149b0bda39955dffac>>
88
*/
99

1010
/**
@@ -25,6 +25,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
2525

2626
override fun commonTestFlag(): Boolean = false
2727

28+
override fun animatedShouldSignalBatch(): Boolean = false
29+
2830
override fun disableMountItemReorderingAndroid(): Boolean = false
2931

3032
override fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean = false

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

+12-1
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<<1693dced312625bbfedce5f2dfa9816c>>
7+
* @generated SignedSource<<0fb76e329360157ea9772a0d8bebc873>>
88
*/
99

1010
/**
@@ -25,6 +25,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
2525
private val accessedFeatureFlags = mutableSetOf<String>()
2626

2727
private var commonTestFlagCache: Boolean? = null
28+
private var animatedShouldSignalBatchCache: Boolean? = null
2829
private var disableMountItemReorderingAndroidCache: Boolean? = null
2930
private var enableAccumulatedUpdatesInRawPropsAndroidCache: Boolean? = null
3031
private var enableBridgelessArchitectureCache: Boolean? = null
@@ -76,6 +77,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
7677
return cached
7778
}
7879

80+
override fun animatedShouldSignalBatch(): Boolean {
81+
var cached = animatedShouldSignalBatchCache
82+
if (cached == null) {
83+
cached = currentProvider.animatedShouldSignalBatch()
84+
accessedFeatureFlags.add("animatedShouldSignalBatch")
85+
animatedShouldSignalBatchCache = cached
86+
}
87+
return cached
88+
}
89+
7990
override fun disableMountItemReorderingAndroid(): Boolean {
8091
var cached = disableMountItemReorderingAndroidCache
8192
if (cached == null) {

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

+3-1
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<<2f2bbf0a92c3af728de6ea38dc374b94>>
7+
* @generated SignedSource<<0c16f7af743a6c4d7aaabf010c1c7327>>
88
*/
99

1010
/**
@@ -25,6 +25,8 @@ import com.facebook.proguard.annotations.DoNotStrip
2525
public interface ReactNativeFeatureFlagsProvider {
2626
@DoNotStrip public fun commonTestFlag(): Boolean
2727

28+
@DoNotStrip public fun animatedShouldSignalBatch(): Boolean
29+
2830
@DoNotStrip public fun disableMountItemReorderingAndroid(): Boolean
2931

3032
@DoNotStrip public fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean

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

+15-1
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<<14c3186a1395a23befb73fc9da972de7>>
7+
* @generated SignedSource<<c866e69278d249dd79cb2fc193d1a7e2>>
88
*/
99

1010
/**
@@ -45,6 +45,12 @@ class ReactNativeFeatureFlagsProviderHolder
4545
return method(javaProvider_);
4646
}
4747

48+
bool animatedShouldSignalBatch() override {
49+
static const auto method =
50+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("animatedShouldSignalBatch");
51+
return method(javaProvider_);
52+
}
53+
4854
bool disableMountItemReorderingAndroid() override {
4955
static const auto method =
5056
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("disableMountItemReorderingAndroid");
@@ -294,6 +300,11 @@ bool JReactNativeFeatureFlagsCxxInterop::commonTestFlag(
294300
return ReactNativeFeatureFlags::commonTestFlag();
295301
}
296302

303+
bool JReactNativeFeatureFlagsCxxInterop::animatedShouldSignalBatch(
304+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
305+
return ReactNativeFeatureFlags::animatedShouldSignalBatch();
306+
}
307+
297308
bool JReactNativeFeatureFlagsCxxInterop::disableMountItemReorderingAndroid(
298309
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
299310
return ReactNativeFeatureFlags::disableMountItemReorderingAndroid();
@@ -528,6 +539,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
528539
makeNativeMethod(
529540
"commonTestFlag",
530541
JReactNativeFeatureFlagsCxxInterop::commonTestFlag),
542+
makeNativeMethod(
543+
"animatedShouldSignalBatch",
544+
JReactNativeFeatureFlagsCxxInterop::animatedShouldSignalBatch),
531545
makeNativeMethod(
532546
"disableMountItemReorderingAndroid",
533547
JReactNativeFeatureFlagsCxxInterop::disableMountItemReorderingAndroid),

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

+4-1
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<<5edcb3baccc7a27525ba6ca43b2aab8a>>
7+
* @generated SignedSource<<ee83dc14463351d400cd75624c803176>>
88
*/
99

1010
/**
@@ -33,6 +33,9 @@ class JReactNativeFeatureFlagsCxxInterop
3333
static bool commonTestFlag(
3434
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
3535

36+
static bool animatedShouldSignalBatch(
37+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
38+
3639
static bool disableMountItemReorderingAndroid(
3740
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
3841

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

+5-1
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<<98c62bb40ef9c03af6e3e2d758cef7ec>>
7+
* @generated SignedSource<<4d47f61435ba3a74e84752a02def81c2>>
88
*/
99

1010
/**
@@ -30,6 +30,10 @@ bool ReactNativeFeatureFlags::commonTestFlag() {
3030
return getAccessor().commonTestFlag();
3131
}
3232

33+
bool ReactNativeFeatureFlags::animatedShouldSignalBatch() {
34+
return getAccessor().animatedShouldSignalBatch();
35+
}
36+
3337
bool ReactNativeFeatureFlags::disableMountItemReorderingAndroid() {
3438
return getAccessor().disableMountItemReorderingAndroid();
3539
}

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

+6-1
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<<452dc78526d49a23c5052bd1ecd130d2>>
7+
* @generated SignedSource<<29cdbefbe02064df4fb65388e64f95a4>>
88
*/
99

1010
/**
@@ -44,6 +44,11 @@ class ReactNativeFeatureFlags {
4444
*/
4545
RN_EXPORT static bool commonTestFlag();
4646

47+
/**
48+
* Enables start- and finishOperationBatch on any platform.
49+
*/
50+
RN_EXPORT static bool animatedShouldSignalBatch();
51+
4752
/**
4853
* Prevent FabricMountingManager from reordering mountitems, which may lead to invalid state on the UI thread
4954
*/

0 commit comments

Comments
 (0)