Skip to content

Commit ac602f7

Browse files
committed
Add enableAnimatedPropsInLayoutReads feature flag
Experimental flag, off by default, for including the animated props of the shared animated backend in layout reads from JS (measure, measureInWindow, measureLayout, getBoundingClientRect, ...). Nothing reads it yet. Generated with `yarn featureflags --update`.
1 parent 7c1e281 commit ac602f7

22 files changed

Lines changed: 232 additions & 109 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<<9a675a67a9ce5e7ca443dd319e2af91a>>
7+
* @generated SignedSource<<76fb08c54f570eafa30a41b85cc6b103>>
88
*/
99

1010
/**
@@ -126,6 +126,12 @@ public object ReactNativeFeatureFlags {
126126
@JvmStatic
127127
public fun enableAndroidTextMeasurementOptimizations(): Boolean = accessor.enableAndroidTextMeasurementOptimizations()
128128

129+
/**
130+
* When enabled with the shared animated backend, layout reads from JS (measure, getBoundingClientRect, etc.) include the animated props that were applied to views but not committed to the shadow tree yet.
131+
*/
132+
@JvmStatic
133+
public fun enableAnimatedPropsInLayoutReads(): Boolean = accessor.enableAnimatedPropsInLayoutReads()
134+
129135
/**
130136
* Runs multi-source image disk-cache checks asynchronously on Android.
131137
*/

‎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<<6b668cbb1ef60126d7e08b2d853b1262>>
7+
* @generated SignedSource<<33d6a430a3a271d323f3b2bccc0fada4>>
88
*/
99

1010
/**
@@ -36,6 +36,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
3636
private var enableAccumulatedUpdatesInRawPropsAndroidCache: Boolean? = null
3737
private var enableAliasedTextRoleInheritanceCache: Boolean? = null
3838
private var enableAndroidTextMeasurementOptimizationsCache: Boolean? = null
39+
private var enableAnimatedPropsInLayoutReadsCache: Boolean? = null
3940
private var enableAsyncDiskCacheCheckInMultiSourceImageAndroidCache: Boolean? = null
4041
private var enableBridgelessArchitectureCache: Boolean? = null
4142
private var enableCppPropsIteratorSetterCache: Boolean? = null
@@ -268,6 +269,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
268269
return cached
269270
}
270271

272+
override fun enableAnimatedPropsInLayoutReads(): Boolean {
273+
var cached = enableAnimatedPropsInLayoutReadsCache
274+
if (cached == null) {
275+
cached = ReactNativeFeatureFlagsCxxInterop.enableAnimatedPropsInLayoutReads()
276+
enableAnimatedPropsInLayoutReadsCache = cached
277+
}
278+
return cached
279+
}
280+
271281
override fun enableAsyncDiskCacheCheckInMultiSourceImageAndroid(): Boolean {
272282
var cached = enableAsyncDiskCacheCheckInMultiSourceImageAndroidCache
273283
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<<0890a0b7979d00172b0a79abd94f6c3e>>
7+
* @generated SignedSource<<a1d142a5a18aa0140adadfcce5b595c5>>
88
*/
99

1010
/**
@@ -60,6 +60,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
6060

6161
@DoNotStrip @JvmStatic public external fun enableAndroidTextMeasurementOptimizations(): Boolean
6262

63+
@DoNotStrip @JvmStatic public external fun enableAnimatedPropsInLayoutReads(): Boolean
64+
6365
@DoNotStrip @JvmStatic public external fun enableAsyncDiskCacheCheckInMultiSourceImageAndroid(): Boolean
6466

6567
@DoNotStrip @JvmStatic public external fun enableBridgelessArchitecture(): 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<<3ca183dbeeb3fdeac98780267df9dff2>>
7+
* @generated SignedSource<<67494bd1ee5492e1620639461f6a4711>>
88
*/
99

1010
/**
@@ -55,6 +55,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
5555

5656
override fun enableAndroidTextMeasurementOptimizations(): Boolean = true
5757

58+
override fun enableAnimatedPropsInLayoutReads(): Boolean = false
59+
5860
override fun enableAsyncDiskCacheCheckInMultiSourceImageAndroid(): Boolean = false
5961

6062
override fun enableBridgelessArchitecture(): Boolean = true

‎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<<ba5e55492e7f521229dd62ac1274924e>>
7+
* @generated SignedSource<<0de5b4bcdcae49240ce587631c8b8683>>
88
*/
99

1010
/**
@@ -40,6 +40,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
4040
private var enableAccumulatedUpdatesInRawPropsAndroidCache: Boolean? = null
4141
private var enableAliasedTextRoleInheritanceCache: Boolean? = null
4242
private var enableAndroidTextMeasurementOptimizationsCache: Boolean? = null
43+
private var enableAnimatedPropsInLayoutReadsCache: Boolean? = null
4344
private var enableAsyncDiskCacheCheckInMultiSourceImageAndroidCache: Boolean? = null
4445
private var enableBridgelessArchitectureCache: Boolean? = null
4546
private var enableCppPropsIteratorSetterCache: Boolean? = null
@@ -288,6 +289,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
288289
return cached
289290
}
290291

292+
override fun enableAnimatedPropsInLayoutReads(): Boolean {
293+
var cached = enableAnimatedPropsInLayoutReadsCache
294+
if (cached == null) {
295+
cached = currentProvider.enableAnimatedPropsInLayoutReads()
296+
accessedFeatureFlags.add("enableAnimatedPropsInLayoutReads")
297+
enableAnimatedPropsInLayoutReadsCache = cached
298+
}
299+
return cached
300+
}
301+
291302
override fun enableAsyncDiskCacheCheckInMultiSourceImageAndroid(): Boolean {
292303
var cached = enableAsyncDiskCacheCheckInMultiSourceImageAndroidCache
293304
if (cached == null) {

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsOverrides_RNOSS_Experimental_Android.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<<d5a27cf5db5bc3d3a0dd8b40d0fbe9a7>>
7+
* @generated SignedSource<<7559bba24988e7f6a9e3339d15d15402>>
88
*/
99

1010
/**
@@ -27,6 +27,8 @@ public open class ReactNativeFeatureFlagsOverrides_RNOSS_Experimental_Android :
2727

2828
override fun disableIdleMountItemFrameCallbackRearmAndroid(): Boolean = true
2929

30+
override fun enableAnimatedPropsInLayoutReads(): Boolean = true
31+
3032
override fun enableFlexboxAutoMinSizeInStrictMode(): Boolean = true
3133

3234
override fun preventShadowTreeCommitExhaustion(): Boolean = true

‎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<<8d21b1b7d2bd5c5fe3a111c0d411f742>>
7+
* @generated SignedSource<<0b689fd4cfc661e3ce5cc36979bc7fe4>>
88
*/
99

1010
/**
@@ -55,6 +55,8 @@ public interface ReactNativeFeatureFlagsProvider {
5555

5656
@DoNotStrip public fun enableAndroidTextMeasurementOptimizations(): Boolean
5757

58+
@DoNotStrip public fun enableAnimatedPropsInLayoutReads(): Boolean
59+
5860
@DoNotStrip public fun enableAsyncDiskCacheCheckInMultiSourceImageAndroid(): Boolean
5961

6062
@DoNotStrip public fun enableBridgelessArchitecture(): 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<<fed02254c80f001c5de5b8df9353b2ba>>
7+
* @generated SignedSource<<137747bee1a0526572418ce7814c4dfa>>
88
*/
99

1010
/**
@@ -135,6 +135,12 @@ class ReactNativeFeatureFlagsJavaProvider
135135
return method(javaProvider_);
136136
}
137137

138+
bool enableAnimatedPropsInLayoutReads() override {
139+
static const auto method =
140+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableAnimatedPropsInLayoutReads");
141+
return method(javaProvider_);
142+
}
143+
138144
bool enableAsyncDiskCacheCheckInMultiSourceImageAndroid() override {
139145
static const auto method =
140146
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableAsyncDiskCacheCheckInMultiSourceImageAndroid");
@@ -741,6 +747,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableAndroidTextMeasurementOptimizatio
741747
return ReactNativeFeatureFlags::enableAndroidTextMeasurementOptimizations();
742748
}
743749

750+
bool JReactNativeFeatureFlagsCxxInterop::enableAnimatedPropsInLayoutReads(
751+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
752+
return ReactNativeFeatureFlags::enableAnimatedPropsInLayoutReads();
753+
}
754+
744755
bool JReactNativeFeatureFlagsCxxInterop::enableAsyncDiskCacheCheckInMultiSourceImageAndroid(
745756
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
746757
return ReactNativeFeatureFlags::enableAsyncDiskCacheCheckInMultiSourceImageAndroid();
@@ -1255,6 +1266,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
12551266
makeNativeMethod(
12561267
"enableAndroidTextMeasurementOptimizations",
12571268
JReactNativeFeatureFlagsCxxInterop::enableAndroidTextMeasurementOptimizations),
1269+
makeNativeMethod(
1270+
"enableAnimatedPropsInLayoutReads",
1271+
JReactNativeFeatureFlagsCxxInterop::enableAnimatedPropsInLayoutReads),
12581272
makeNativeMethod(
12591273
"enableAsyncDiskCacheCheckInMultiSourceImageAndroid",
12601274
JReactNativeFeatureFlagsCxxInterop::enableAsyncDiskCacheCheckInMultiSourceImageAndroid),

‎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<<beae68275d923b3d5981340a6861348d>>
7+
* @generated SignedSource<<210b4409704aa8cbccad76a86a0eb3d5>>
88
*/
99

1010
/**
@@ -78,6 +78,9 @@ class JReactNativeFeatureFlagsCxxInterop
7878
static bool enableAndroidTextMeasurementOptimizations(
7979
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
8080

81+
static bool enableAnimatedPropsInLayoutReads(
82+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
83+
8184
static bool enableAsyncDiskCacheCheckInMultiSourceImageAndroid(
8285
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
8386

‎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<<44185d291de75775e5b1b41fc6aacb8c>>
7+
* @generated SignedSource<<c00f7c0b88b8412d4febd2cb7aae2932>>
88
*/
99

1010
/**
@@ -90,6 +90,10 @@ bool ReactNativeFeatureFlags::enableAndroidTextMeasurementOptimizations() {
9090
return getAccessor().enableAndroidTextMeasurementOptimizations();
9191
}
9292

93+
bool ReactNativeFeatureFlags::enableAnimatedPropsInLayoutReads() {
94+
return getAccessor().enableAnimatedPropsInLayoutReads();
95+
}
96+
9397
bool ReactNativeFeatureFlags::enableAsyncDiskCacheCheckInMultiSourceImageAndroid() {
9498
return getAccessor().enableAsyncDiskCacheCheckInMultiSourceImageAndroid();
9599
}

0 commit comments

Comments
 (0)