Skip to content

Commit 7146c13

Browse files
fabriziocuccimeta-codesync[bot]
authored andcommitted
Remove enableClipChildrenForOverflowHidden feature flag (#55547)
Summary: Pull Request resolved: #55547 Changelog: [Internal] It looks like we have completely misunderstood the semantic of `clipChildren`. Looking at the Android [source code](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/core/java/android/view/ViewGroup.java;l=4607?q=setClipToPadding&ss=android%2Fplatform%2Fsuperproject&fbclid=IwY2xjawP8LExleHRuA2FlbQIxMQBzcnRjBmFwcF9pZAEwAAEeQkZx96WcTaA0mIUVGXeFAxH_aLVBMR0an0N8jeKCYX4E-j9HW0eLnzZcSJI_aem__yWzHP0_x-bPxCQS1nN19w), it seems that `setClipChildren(true)` on a ViewGroup X means clipping **each child** to the **child's own bounds**, not the parent's bound. Which means also [this](https://www.internalfb.com/code/aosp-vendor-meta-coresdk/[oculus-14.0%3Af0b9166acbb68da2e1e9f7622ba1b7fcee672ebc]/api-src/volumetricwindow/java/horizonos/view/interaction/providers/ViewInteractionNodeProvider.java?lines=502) line in HzOS is based on the same incorrect assumption. Ultimately, RN should not be populating `clipChildren` when `overflow: hidden` is set. Reviewed By: Abbondanzo Differential Revision: D93238810 fbshipit-source-id: aff74b1f339fa707bcec1667580ce710a49f93dd
1 parent 9eb68a5 commit 7146c13

20 files changed

Lines changed: 85 additions & 201 deletions

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

Lines changed: 1 addition & 7 deletions
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<<4549fc9a4f431306b7dc70ef3903b8fd>>
7+
* @generated SignedSource<<67ef2bd30983c949f41e014297dabd6e>>
88
*/
99

1010
/**
@@ -120,12 +120,6 @@ public object ReactNativeFeatureFlags {
120120
@JvmStatic
121121
public fun enableBridgelessArchitecture(): Boolean = accessor.enableBridgelessArchitecture()
122122

123-
/**
124-
* When overflow: hidden is set, also set clipChildren to true so that clipped content does not occlude content outside the parent
125-
*/
126-
@JvmStatic
127-
public fun enableClipChildrenForOverflowHidden(): Boolean = accessor.enableClipChildrenForOverflowHidden()
128-
129123
/**
130124
* Enable prop iterator setter-style construction of Props in C++ (this flag is not used in Java).
131125
*/

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

Lines changed: 1 addition & 11 deletions
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<<0db6bbb173a96ab07c80a3fbe43671b3>>
7+
* @generated SignedSource<<e3373e6363e3d9c35102fcff311570b1>>
88
*/
99

1010
/**
@@ -35,7 +35,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
3535
private var enableAndroidLinearTextCache: Boolean? = null
3636
private var enableAndroidTextMeasurementOptimizationsCache: Boolean? = null
3737
private var enableBridgelessArchitectureCache: Boolean? = null
38-
private var enableClipChildrenForOverflowHiddenCache: Boolean? = null
3938
private var enableCppPropsIteratorSetterCache: Boolean? = null
4039
private var enableCustomFocusSearchOnClippedElementsAndroidCache: Boolean? = null
4140
private var enableDestroyShadowTreeRevisionAsyncCache: Boolean? = null
@@ -237,15 +236,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
237236
return cached
238237
}
239238

240-
override fun enableClipChildrenForOverflowHidden(): Boolean {
241-
var cached = enableClipChildrenForOverflowHiddenCache
242-
if (cached == null) {
243-
cached = ReactNativeFeatureFlagsCxxInterop.enableClipChildrenForOverflowHidden()
244-
enableClipChildrenForOverflowHiddenCache = cached
245-
}
246-
return cached
247-
}
248-
249239
override fun enableCppPropsIteratorSetter(): Boolean {
250240
var cached = enableCppPropsIteratorSetterCache
251241
if (cached == null) {

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

Lines changed: 1 addition & 3 deletions
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<<ec247759261e831159a6f7781bf44998>>
7+
* @generated SignedSource<<ca705ae15584cb6bc81c4b1097adb09a>>
88
*/
99

1010
/**
@@ -58,8 +58,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
5858

5959
@DoNotStrip @JvmStatic public external fun enableBridgelessArchitecture(): Boolean
6060

61-
@DoNotStrip @JvmStatic public external fun enableClipChildrenForOverflowHidden(): Boolean
62-
6361
@DoNotStrip @JvmStatic public external fun enableCppPropsIteratorSetter(): Boolean
6462

6563
@DoNotStrip @JvmStatic public external fun enableCustomFocusSearchOnClippedElementsAndroid(): Boolean

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

Lines changed: 1 addition & 3 deletions
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<<102ac98a8c3f2c1a2150c223a099cf72>>
7+
* @generated SignedSource<<62ddb63e95e2b2aff842c5d13210d742>>
88
*/
99

1010
/**
@@ -53,8 +53,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
5353

5454
override fun enableBridgelessArchitecture(): Boolean = false
5555

56-
override fun enableClipChildrenForOverflowHidden(): Boolean = false
57-
5856
override fun enableCppPropsIteratorSetter(): Boolean = false
5957

6058
override fun enableCustomFocusSearchOnClippedElementsAndroid(): Boolean = true

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

Lines changed: 1 addition & 12 deletions
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<<b7b29f2e01fd0bd43e6509587c862d31>>
7+
* @generated SignedSource<<477ec1cf98790b5219ed37092ae958cc>>
88
*/
99

1010
/**
@@ -39,7 +39,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
3939
private var enableAndroidLinearTextCache: Boolean? = null
4040
private var enableAndroidTextMeasurementOptimizationsCache: Boolean? = null
4141
private var enableBridgelessArchitectureCache: Boolean? = null
42-
private var enableClipChildrenForOverflowHiddenCache: Boolean? = null
4342
private var enableCppPropsIteratorSetterCache: Boolean? = null
4443
private var enableCustomFocusSearchOnClippedElementsAndroidCache: Boolean? = null
4544
private var enableDestroyShadowTreeRevisionAsyncCache: Boolean? = null
@@ -256,16 +255,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
256255
return cached
257256
}
258257

259-
override fun enableClipChildrenForOverflowHidden(): Boolean {
260-
var cached = enableClipChildrenForOverflowHiddenCache
261-
if (cached == null) {
262-
cached = currentProvider.enableClipChildrenForOverflowHidden()
263-
accessedFeatureFlags.add("enableClipChildrenForOverflowHidden")
264-
enableClipChildrenForOverflowHiddenCache = cached
265-
}
266-
return cached
267-
}
268-
269258
override fun enableCppPropsIteratorSetter(): Boolean {
270259
var cached = enableCppPropsIteratorSetterCache
271260
if (cached == null) {

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

Lines changed: 1 addition & 3 deletions
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<<50f2ea7e87e80a247b6c6ce8e2afd0ec>>
7+
* @generated SignedSource<<4480d856ab56f2ecb216610b6e4ae31e>>
88
*/
99

1010
/**
@@ -53,8 +53,6 @@ public interface ReactNativeFeatureFlagsProvider {
5353

5454
@DoNotStrip public fun enableBridgelessArchitecture(): Boolean
5555

56-
@DoNotStrip public fun enableClipChildrenForOverflowHidden(): Boolean
57-
5856
@DoNotStrip public fun enableCppPropsIteratorSetter(): Boolean
5957

6058
@DoNotStrip public fun enableCustomFocusSearchOnClippedElementsAndroid(): Boolean

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

Lines changed: 1 addition & 15 deletions
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<<0460a8b25bfb176e47fb12dc091b1961>>
7+
* @generated SignedSource<<176845e66b87994db4a9199df21740c0>>
88
*/
99

1010
/**
@@ -129,12 +129,6 @@ class ReactNativeFeatureFlagsJavaProvider
129129
return method(javaProvider_);
130130
}
131131

132-
bool enableClipChildrenForOverflowHidden() override {
133-
static const auto method =
134-
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableClipChildrenForOverflowHidden");
135-
return method(javaProvider_);
136-
}
137-
138132
bool enableCppPropsIteratorSetter() override {
139133
static const auto method =
140134
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableCppPropsIteratorSetter");
@@ -604,11 +598,6 @@ bool JReactNativeFeatureFlagsCxxInterop::enableBridgelessArchitecture(
604598
return ReactNativeFeatureFlags::enableBridgelessArchitecture();
605599
}
606600

607-
bool JReactNativeFeatureFlagsCxxInterop::enableClipChildrenForOverflowHidden(
608-
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
609-
return ReactNativeFeatureFlags::enableClipChildrenForOverflowHidden();
610-
}
611-
612601
bool JReactNativeFeatureFlagsCxxInterop::enableCppPropsIteratorSetter(
613602
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
614603
return ReactNativeFeatureFlags::enableCppPropsIteratorSetter();
@@ -1010,9 +999,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
1010999
makeNativeMethod(
10111000
"enableBridgelessArchitecture",
10121001
JReactNativeFeatureFlagsCxxInterop::enableBridgelessArchitecture),
1013-
makeNativeMethod(
1014-
"enableClipChildrenForOverflowHidden",
1015-
JReactNativeFeatureFlagsCxxInterop::enableClipChildrenForOverflowHidden),
10161002
makeNativeMethod(
10171003
"enableCppPropsIteratorSetter",
10181004
JReactNativeFeatureFlagsCxxInterop::enableCppPropsIteratorSetter),

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

Lines changed: 1 addition & 4 deletions
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<<88f40502abd13f8f57015429dd087519>>
7+
* @generated SignedSource<<4078cafe7570b1478adc0b278a25155a>>
88
*/
99

1010
/**
@@ -75,9 +75,6 @@ class JReactNativeFeatureFlagsCxxInterop
7575
static bool enableBridgelessArchitecture(
7676
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
7777

78-
static bool enableClipChildrenForOverflowHidden(
79-
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
80-
8178
static bool enableCppPropsIteratorSetter(
8279
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
8380

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

Lines changed: 1 addition & 5 deletions
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<<d96b2f1e4083046cfc061317d117e762>>
7+
* @generated SignedSource<<e0f2fdab52f83a4bf8156bc4e55e0760>>
88
*/
99

1010
/**
@@ -86,10 +86,6 @@ bool ReactNativeFeatureFlags::enableBridgelessArchitecture() {
8686
return getAccessor().enableBridgelessArchitecture();
8787
}
8888

89-
bool ReactNativeFeatureFlags::enableClipChildrenForOverflowHidden() {
90-
return getAccessor().enableClipChildrenForOverflowHidden();
91-
}
92-
9389
bool ReactNativeFeatureFlags::enableCppPropsIteratorSetter() {
9490
return getAccessor().enableCppPropsIteratorSetter();
9591
}

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

Lines changed: 1 addition & 6 deletions
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<<51a4817654c04c979a33f44e42312dd5>>
7+
* @generated SignedSource<<c24c659a80be5371844c214a69c149bd>>
88
*/
99

1010
/**
@@ -114,11 +114,6 @@ class ReactNativeFeatureFlags {
114114
*/
115115
RN_EXPORT static bool enableBridgelessArchitecture();
116116

117-
/**
118-
* When overflow: hidden is set, also set clipChildren to true so that clipped content does not occlude content outside the parent
119-
*/
120-
RN_EXPORT static bool enableClipChildrenForOverflowHidden();
121-
122117
/**
123118
* Enable prop iterator setter-style construction of Props in C++ (this flag is not used in Java).
124119
*/

0 commit comments

Comments
 (0)