Skip to content

Commit 4d52231

Browse files
fabriziocuccifacebook-github-bot
authored andcommitted
Add syncAndroidClipBoundsWithOverflow feature flag
Summary: Add a new feature flag to gate overriding getClipBounds on Android views to return the padding box when overflow is hidden. This communicates the view's clipping region to the Android framework for correct getGlobalVisibleRect calculations (T253147322, T263753590). Differential Revision: D102353841
1 parent 6411611 commit 4d52231

20 files changed

Lines changed: 152 additions & 36 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<<eb70fd41bc36f1a49849e29bea081007>>
7+
* @generated SignedSource<<cd8218c8b8588f3317bf63ce8d608548>>
88
*/
99

1010
/**
@@ -480,6 +480,12 @@ public object ReactNativeFeatureFlags {
480480
@JvmStatic
481481
public fun skipActivityIdentityAssertionOnHostPause(): Boolean = accessor.skipActivityIdentityAssertionOnHostPause()
482482

483+
/**
484+
* Override getClipBounds on Android views to return the padding box when overflow is hidden
485+
*/
486+
@JvmStatic
487+
public fun syncAndroidClipBoundsWithOverflow(): Boolean = accessor.syncAndroidClipBoundsWithOverflow()
488+
483489
/**
484490
* Enables storing js caller stack when creating promise in native module. This is useful in case of Promise rejection and tracing the cause.
485491
*/

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<<f79ca61a0da053a1661eca4d3a35b081>>
7+
* @generated SignedSource<<4f9f5c1c46217ed6802abd5f786aac19>>
88
*/
99

1010
/**
@@ -95,6 +95,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
9595
private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
9696
private var shouldTriggerResponderTransferOnScrollAndroidCache: Boolean? = null
9797
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
98+
private var syncAndroidClipBoundsWithOverflowCache: Boolean? = null
9899
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
99100
private var updateRuntimeShadowNodeReferencesOnCommitCache: Boolean? = null
100101
private var updateRuntimeShadowNodeReferencesOnCommitThreadCache: Boolean? = null
@@ -787,6 +788,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
787788
return cached
788789
}
789790

791+
override fun syncAndroidClipBoundsWithOverflow(): Boolean {
792+
var cached = syncAndroidClipBoundsWithOverflowCache
793+
if (cached == null) {
794+
cached = ReactNativeFeatureFlagsCxxInterop.syncAndroidClipBoundsWithOverflow()
795+
syncAndroidClipBoundsWithOverflowCache = cached
796+
}
797+
return cached
798+
}
799+
790800
override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean {
791801
var cached = traceTurboModulePromiseRejectionsOnAndroidCache
792802
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<<62d1f0fcdf8e3165480da12575d62826>>
7+
* @generated SignedSource<<8916e9f4a938a69ff175c806db9835d4>>
88
*/
99

1010
/**
@@ -178,6 +178,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
178178

179179
@DoNotStrip @JvmStatic public external fun skipActivityIdentityAssertionOnHostPause(): Boolean
180180

181+
@DoNotStrip @JvmStatic public external fun syncAndroidClipBoundsWithOverflow(): Boolean
182+
181183
@DoNotStrip @JvmStatic public external fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean
182184

183185
@DoNotStrip @JvmStatic public external fun updateRuntimeShadowNodeReferencesOnCommit(): 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<<84ac5b80585f9185c879c81822718d86>>
7+
* @generated SignedSource<<d2b14345bf627e35562530912b3aae1f>>
88
*/
99

1010
/**
@@ -173,6 +173,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
173173

174174
override fun skipActivityIdentityAssertionOnHostPause(): Boolean = false
175175

176+
override fun syncAndroidClipBoundsWithOverflow(): Boolean = false
177+
176178
override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean = false
177179

178180
override fun updateRuntimeShadowNodeReferencesOnCommit(): 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<<3574e23fe8f846e408964af26cf0dd4c>>
7+
* @generated SignedSource<<cbe90c2bf8ba9d34804d97c31edfd31a>>
88
*/
99

1010
/**
@@ -99,6 +99,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
9999
private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
100100
private var shouldTriggerResponderTransferOnScrollAndroidCache: Boolean? = null
101101
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
102+
private var syncAndroidClipBoundsWithOverflowCache: Boolean? = null
102103
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
103104
private var updateRuntimeShadowNodeReferencesOnCommitCache: Boolean? = null
104105
private var updateRuntimeShadowNodeReferencesOnCommitThreadCache: Boolean? = null
@@ -866,6 +867,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
866867
return cached
867868
}
868869

870+
override fun syncAndroidClipBoundsWithOverflow(): Boolean {
871+
var cached = syncAndroidClipBoundsWithOverflowCache
872+
if (cached == null) {
873+
cached = currentProvider.syncAndroidClipBoundsWithOverflow()
874+
accessedFeatureFlags.add("syncAndroidClipBoundsWithOverflow")
875+
syncAndroidClipBoundsWithOverflowCache = cached
876+
}
877+
return cached
878+
}
879+
869880
override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean {
870881
var cached = traceTurboModulePromiseRejectionsOnAndroidCache
871882
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<<9222fd90d191a91893e2c58770d83259>>
7+
* @generated SignedSource<<536a5156deea17740dd24782bf79feb4>>
88
*/
99

1010
/**
@@ -173,6 +173,8 @@ public interface ReactNativeFeatureFlagsProvider {
173173

174174
@DoNotStrip public fun skipActivityIdentityAssertionOnHostPause(): Boolean
175175

176+
@DoNotStrip public fun syncAndroidClipBoundsWithOverflow(): Boolean
177+
176178
@DoNotStrip public fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean
177179

178180
@DoNotStrip public fun updateRuntimeShadowNodeReferencesOnCommit(): 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<<e8cf371a99a72250ea1b0104dc7f8254>>
7+
* @generated SignedSource<<b99eaffc2d11a08a6efe32b2e2732965>>
88
*/
99

1010
/**
@@ -489,6 +489,12 @@ class ReactNativeFeatureFlagsJavaProvider
489489
return method(javaProvider_);
490490
}
491491

492+
bool syncAndroidClipBoundsWithOverflow() override {
493+
static const auto method =
494+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("syncAndroidClipBoundsWithOverflow");
495+
return method(javaProvider_);
496+
}
497+
492498
bool traceTurboModulePromiseRejectionsOnAndroid() override {
493499
static const auto method =
494500
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("traceTurboModulePromiseRejectionsOnAndroid");
@@ -964,6 +970,11 @@ bool JReactNativeFeatureFlagsCxxInterop::skipActivityIdentityAssertionOnHostPaus
964970
return ReactNativeFeatureFlags::skipActivityIdentityAssertionOnHostPause();
965971
}
966972

973+
bool JReactNativeFeatureFlagsCxxInterop::syncAndroidClipBoundsWithOverflow(
974+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
975+
return ReactNativeFeatureFlags::syncAndroidClipBoundsWithOverflow();
976+
}
977+
967978
bool JReactNativeFeatureFlagsCxxInterop::traceTurboModulePromiseRejectionsOnAndroid(
968979
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
969980
return ReactNativeFeatureFlags::traceTurboModulePromiseRejectionsOnAndroid();
@@ -1300,6 +1311,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
13001311
makeNativeMethod(
13011312
"skipActivityIdentityAssertionOnHostPause",
13021313
JReactNativeFeatureFlagsCxxInterop::skipActivityIdentityAssertionOnHostPause),
1314+
makeNativeMethod(
1315+
"syncAndroidClipBoundsWithOverflow",
1316+
JReactNativeFeatureFlagsCxxInterop::syncAndroidClipBoundsWithOverflow),
13031317
makeNativeMethod(
13041318
"traceTurboModulePromiseRejectionsOnAndroid",
13051319
JReactNativeFeatureFlagsCxxInterop::traceTurboModulePromiseRejectionsOnAndroid),

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<<773741594e911047dac28904e9fc9544>>
7+
* @generated SignedSource<<4be32bad403baeca1a28f19ad181c42c>>
88
*/
99

1010
/**
@@ -255,6 +255,9 @@ class JReactNativeFeatureFlagsCxxInterop
255255
static bool skipActivityIdentityAssertionOnHostPause(
256256
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
257257

258+
static bool syncAndroidClipBoundsWithOverflow(
259+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
260+
258261
static bool traceTurboModulePromiseRejectionsOnAndroid(
259262
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
260263

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<<6a15a6444767342acf4da0c0c8aa6208>>
7+
* @generated SignedSource<<b55a79c9f84947fa4c12b04f15cfeefb>>
88
*/
99

1010
/**
@@ -326,6 +326,10 @@ bool ReactNativeFeatureFlags::skipActivityIdentityAssertionOnHostPause() {
326326
return getAccessor().skipActivityIdentityAssertionOnHostPause();
327327
}
328328

329+
bool ReactNativeFeatureFlags::syncAndroidClipBoundsWithOverflow() {
330+
return getAccessor().syncAndroidClipBoundsWithOverflow();
331+
}
332+
329333
bool ReactNativeFeatureFlags::traceTurboModulePromiseRejectionsOnAndroid() {
330334
return getAccessor().traceTurboModulePromiseRejectionsOnAndroid();
331335
}

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<<62d1840f9a39eaceaa800542b7351a41>>
7+
* @generated SignedSource<<8e9b09843bf4a0312b254559a975f612>>
88
*/
99

1010
/**
@@ -414,6 +414,11 @@ class ReactNativeFeatureFlags {
414414
*/
415415
RN_EXPORT static bool skipActivityIdentityAssertionOnHostPause();
416416

417+
/**
418+
* Override getClipBounds on Android views to return the padding box when overflow is hidden
419+
*/
420+
RN_EXPORT static bool syncAndroidClipBoundsWithOverflow();
421+
417422
/**
418423
* Enables storing js caller stack when creating promise in native module. This is useful in case of Promise rejection and tracing the cause.
419424
*/

0 commit comments

Comments
 (0)