Skip to content

Commit aef53bf

Browse files
CalixTangfacebook-github-bot
authored andcommitted
Add VirtualViewContainerState version native feature flag (facebook#54156)
Summary: Introduces new React Native feature flag for VirtualViewContainerState versioning changes. Follow up diffs will create classic and experimental versions of VirtualViewContainerState. This feature flag is meant to eventually be overridden with MetaConfig variables. Reviewed By: lunaleaps Differential Revision: D84569199
1 parent a63262f commit aef53bf

20 files changed

+170
-53
lines changed

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<<132ff30c4a5ecf6b38dd0d6cc47d3abc>>
7+
* @generated SignedSource<<2ac9938108dfe555fc7e7d875cc21987>>
88
*/
99

1010
/**
@@ -312,6 +312,12 @@ public object ReactNativeFeatureFlags {
312312
@JvmStatic
313313
public fun enableViewRecyclingForView(): Boolean = accessor.enableViewRecyclingForView()
314314

315+
/**
316+
* Enables the experimental version of `VirtualViewContainerState`.
317+
*/
318+
@JvmStatic
319+
public fun enableVirtualViewContainerStateExperimental(): Boolean = accessor.enableVirtualViewContainerStateExperimental()
320+
315321
/**
316322
* Enables VirtualView debug features such as logging and overlays.
317323
*/

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<<38838d89c61124afce1f13045593aeb4>>
7+
* @generated SignedSource<<3cb451816d08f2f3cefb757f1e2ce72a>>
88
*/
99

1010
/**
@@ -67,6 +67,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
6767
private var enableViewRecyclingForScrollViewCache: Boolean? = null
6868
private var enableViewRecyclingForTextCache: Boolean? = null
6969
private var enableViewRecyclingForViewCache: Boolean? = null
70+
private var enableVirtualViewContainerStateExperimentalCache: Boolean? = null
7071
private var enableVirtualViewDebugFeaturesCache: Boolean? = null
7172
private var enableVirtualViewRenderStateCache: Boolean? = null
7273
private var enableVirtualViewWindowFocusDetectionCache: Boolean? = null
@@ -524,6 +525,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
524525
return cached
525526
}
526527

528+
override fun enableVirtualViewContainerStateExperimental(): Boolean {
529+
var cached = enableVirtualViewContainerStateExperimentalCache
530+
if (cached == null) {
531+
cached = ReactNativeFeatureFlagsCxxInterop.enableVirtualViewContainerStateExperimental()
532+
enableVirtualViewContainerStateExperimentalCache = cached
533+
}
534+
return cached
535+
}
536+
527537
override fun enableVirtualViewDebugFeatures(): Boolean {
528538
var cached = enableVirtualViewDebugFeaturesCache
529539
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<<ef75a380b395d88cb0551d3a44d9961d>>
7+
* @generated SignedSource<<de0fe8d116ca48e918f67c4c32f1183f>>
88
*/
99

1010
/**
@@ -122,6 +122,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
122122

123123
@DoNotStrip @JvmStatic public external fun enableViewRecyclingForView(): Boolean
124124

125+
@DoNotStrip @JvmStatic public external fun enableVirtualViewContainerStateExperimental(): Boolean
126+
125127
@DoNotStrip @JvmStatic public external fun enableVirtualViewDebugFeatures(): Boolean
126128

127129
@DoNotStrip @JvmStatic public external fun enableVirtualViewRenderState(): 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<<c601ddc9bd62282f8079d0cb3578675d>>
7+
* @generated SignedSource<<674f7910fe5dcd750ba2661122c82670>>
88
*/
99

1010
/**
@@ -117,6 +117,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
117117

118118
override fun enableViewRecyclingForView(): Boolean = true
119119

120+
override fun enableVirtualViewContainerStateExperimental(): Boolean = false
121+
120122
override fun enableVirtualViewDebugFeatures(): Boolean = false
121123

122124
override fun enableVirtualViewRenderState(): 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<<2fa1e7cd2e1d4009dfa09a5fd27a872a>>
7+
* @generated SignedSource<<5facf1328467d62b41dd9f82c5111882>>
88
*/
99

1010
/**
@@ -71,6 +71,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
7171
private var enableViewRecyclingForScrollViewCache: Boolean? = null
7272
private var enableViewRecyclingForTextCache: Boolean? = null
7373
private var enableViewRecyclingForViewCache: Boolean? = null
74+
private var enableVirtualViewContainerStateExperimentalCache: Boolean? = null
7475
private var enableVirtualViewDebugFeaturesCache: Boolean? = null
7576
private var enableVirtualViewRenderStateCache: Boolean? = null
7677
private var enableVirtualViewWindowFocusDetectionCache: Boolean? = null
@@ -575,6 +576,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
575576
return cached
576577
}
577578

579+
override fun enableVirtualViewContainerStateExperimental(): Boolean {
580+
var cached = enableVirtualViewContainerStateExperimentalCache
581+
if (cached == null) {
582+
cached = currentProvider.enableVirtualViewContainerStateExperimental()
583+
accessedFeatureFlags.add("enableVirtualViewContainerStateExperimental")
584+
enableVirtualViewContainerStateExperimentalCache = cached
585+
}
586+
return cached
587+
}
588+
578589
override fun enableVirtualViewDebugFeatures(): Boolean {
579590
var cached = enableVirtualViewDebugFeaturesCache
580591
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<<901e5678bff081bcb6b8e2d46364b977>>
7+
* @generated SignedSource<<5a9a51638a72bda657f312260bb1297a>>
88
*/
99

1010
/**
@@ -117,6 +117,8 @@ public interface ReactNativeFeatureFlagsProvider {
117117

118118
@DoNotStrip public fun enableViewRecyclingForView(): Boolean
119119

120+
@DoNotStrip public fun enableVirtualViewContainerStateExperimental(): Boolean
121+
120122
@DoNotStrip public fun enableVirtualViewDebugFeatures(): Boolean
121123

122124
@DoNotStrip public fun enableVirtualViewRenderState(): 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<<285ec8cc3b3e5f55c5c31106b6df8717>>
7+
* @generated SignedSource<<d54fab7b1b7bfb99ed1ff6ba0141a013>>
88
*/
99

1010
/**
@@ -321,6 +321,12 @@ class ReactNativeFeatureFlagsJavaProvider
321321
return method(javaProvider_);
322322
}
323323

324+
bool enableVirtualViewContainerStateExperimental() override {
325+
static const auto method =
326+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableVirtualViewContainerStateExperimental");
327+
return method(javaProvider_);
328+
}
329+
324330
bool enableVirtualViewDebugFeatures() override {
325331
static const auto method =
326332
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableVirtualViewDebugFeatures");
@@ -758,6 +764,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableViewRecyclingForView(
758764
return ReactNativeFeatureFlags::enableViewRecyclingForView();
759765
}
760766

767+
bool JReactNativeFeatureFlagsCxxInterop::enableVirtualViewContainerStateExperimental(
768+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
769+
return ReactNativeFeatureFlags::enableVirtualViewContainerStateExperimental();
770+
}
771+
761772
bool JReactNativeFeatureFlagsCxxInterop::enableVirtualViewDebugFeatures(
762773
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
763774
return ReactNativeFeatureFlags::enableVirtualViewDebugFeatures();
@@ -1095,6 +1106,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
10951106
makeNativeMethod(
10961107
"enableViewRecyclingForView",
10971108
JReactNativeFeatureFlagsCxxInterop::enableViewRecyclingForView),
1109+
makeNativeMethod(
1110+
"enableVirtualViewContainerStateExperimental",
1111+
JReactNativeFeatureFlagsCxxInterop::enableVirtualViewContainerStateExperimental),
10981112
makeNativeMethod(
10991113
"enableVirtualViewDebugFeatures",
11001114
JReactNativeFeatureFlagsCxxInterop::enableVirtualViewDebugFeatures),

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<<34ad93365b68934d051b0de522a36014>>
7+
* @generated SignedSource<<5789c040408e16ad3e5f79b169084c15>>
88
*/
99

1010
/**
@@ -171,6 +171,9 @@ class JReactNativeFeatureFlagsCxxInterop
171171
static bool enableViewRecyclingForView(
172172
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
173173

174+
static bool enableVirtualViewContainerStateExperimental(
175+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
176+
174177
static bool enableVirtualViewDebugFeatures(
175178
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
176179

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<<5fe8801a343267a840956183ca93c757>>
7+
* @generated SignedSource<<d65469ea355ee606c40814c142a391f7>>
88
*/
99

1010
/**
@@ -214,6 +214,10 @@ bool ReactNativeFeatureFlags::enableViewRecyclingForView() {
214214
return getAccessor().enableViewRecyclingForView();
215215
}
216216

217+
bool ReactNativeFeatureFlags::enableVirtualViewContainerStateExperimental() {
218+
return getAccessor().enableVirtualViewContainerStateExperimental();
219+
}
220+
217221
bool ReactNativeFeatureFlags::enableVirtualViewDebugFeatures() {
218222
return getAccessor().enableVirtualViewDebugFeatures();
219223
}

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<<67cb9ad627e865b24b380be1ef6e0db7>>
7+
* @generated SignedSource<<1067eff3cc68c8aa3177974dd13b7845>>
88
*/
99

1010
/**
@@ -274,6 +274,11 @@ class ReactNativeFeatureFlags {
274274
*/
275275
RN_EXPORT static bool enableViewRecyclingForView();
276276

277+
/**
278+
* Enables the experimental version of `VirtualViewContainerState`.
279+
*/
280+
RN_EXPORT static bool enableVirtualViewContainerStateExperimental();
281+
277282
/**
278283
* Enables VirtualView debug features such as logging and overlays.
279284
*/

0 commit comments

Comments
 (0)