Skip to content

Commit 20319bd

Browse files
fabriziocuccimeta-codesync[bot]
authored andcommitted
Remove shouldSetIsClickableByDefault feature flag (#55105)
Summary: Pull Request resolved: #55105 Changelog: [Internal] Reviewed By: javache Differential Revision: D90378897 fbshipit-source-id: 48ff38b66ee0e45cf9325465a4664b71ea54a395
1 parent f500af4 commit 20319bd

21 files changed

Lines changed: 35 additions & 179 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<<f65e9c6c5c404c0db2fe537917b27557>>
7+
* @generated SignedSource<<b9a49024788f6d78e8bce1d8d7a00f16>>
88
*/
99

1010
/**
@@ -432,12 +432,6 @@ public object ReactNativeFeatureFlags {
432432
@JvmStatic
433433
public fun shouldSetEnabledBasedOnAccessibilityState(): Boolean = accessor.shouldSetEnabledBasedOnAccessibilityState()
434434

435-
/**
436-
* Sets isClickable=true by default on all React Native views on Android to improve UI harvesting detection while maintaining focusable=false to preserve expected behavior.
437-
*/
438-
@JvmStatic
439-
public fun shouldSetIsClickableByDefault(): Boolean = accessor.shouldSetIsClickableByDefault()
440-
441435
/**
442436
* Do not emit touchcancel from Android ScrollView, instead native topScroll event will trigger responder transfer and terminate in RN renderer.
443437
*/

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<<907fd6d60faaeb4c28ffd3b40928347e>>
7+
* @generated SignedSource<<a45409be422bc544a43295eb4fe21074>>
88
*/
99

1010
/**
@@ -87,7 +87,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
8787
private var shouldResetClickableWhenRecyclingViewCache: Boolean? = null
8888
private var shouldResetOnClickListenerWhenRecyclingViewCache: Boolean? = null
8989
private var shouldSetEnabledBasedOnAccessibilityStateCache: Boolean? = null
90-
private var shouldSetIsClickableByDefaultCache: Boolean? = null
9190
private var shouldTriggerResponderTransferOnScrollAndroidCache: Boolean? = null
9291
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
9392
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
@@ -706,15 +705,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
706705
return cached
707706
}
708707

709-
override fun shouldSetIsClickableByDefault(): Boolean {
710-
var cached = shouldSetIsClickableByDefaultCache
711-
if (cached == null) {
712-
cached = ReactNativeFeatureFlagsCxxInterop.shouldSetIsClickableByDefault()
713-
shouldSetIsClickableByDefaultCache = cached
714-
}
715-
return cached
716-
}
717-
718708
override fun shouldTriggerResponderTransferOnScrollAndroid(): Boolean {
719709
var cached = shouldTriggerResponderTransferOnScrollAndroidCache
720710
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<<497416e09c55455dccb439c15955ee00>>
7+
* @generated SignedSource<<645d8233955b21a3b2d4e822976abd35>>
88
*/
99

1010
/**
@@ -162,8 +162,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
162162

163163
@DoNotStrip @JvmStatic public external fun shouldSetEnabledBasedOnAccessibilityState(): Boolean
164164

165-
@DoNotStrip @JvmStatic public external fun shouldSetIsClickableByDefault(): Boolean
166-
167165
@DoNotStrip @JvmStatic public external fun shouldTriggerResponderTransferOnScrollAndroid(): Boolean
168166

169167
@DoNotStrip @JvmStatic public external fun skipActivityIdentityAssertionOnHostPause(): 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<<26eb9af61fedaacaadc23a8698ff6117>>
7+
* @generated SignedSource<<d08d1352bfe98e3e84e58ab9ad2e70c6>>
88
*/
99

1010
/**
@@ -157,8 +157,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
157157

158158
override fun shouldSetEnabledBasedOnAccessibilityState(): Boolean = true
159159

160-
override fun shouldSetIsClickableByDefault(): Boolean = false
161-
162160
override fun shouldTriggerResponderTransferOnScrollAndroid(): Boolean = false
163161

164162
override fun skipActivityIdentityAssertionOnHostPause(): Boolean = false

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

1010
/**
@@ -91,7 +91,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
9191
private var shouldResetClickableWhenRecyclingViewCache: Boolean? = null
9292
private var shouldResetOnClickListenerWhenRecyclingViewCache: Boolean? = null
9393
private var shouldSetEnabledBasedOnAccessibilityStateCache: Boolean? = null
94-
private var shouldSetIsClickableByDefaultCache: Boolean? = null
9594
private var shouldTriggerResponderTransferOnScrollAndroidCache: Boolean? = null
9695
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
9796
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
@@ -777,16 +776,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
777776
return cached
778777
}
779778

780-
override fun shouldSetIsClickableByDefault(): Boolean {
781-
var cached = shouldSetIsClickableByDefaultCache
782-
if (cached == null) {
783-
cached = currentProvider.shouldSetIsClickableByDefault()
784-
accessedFeatureFlags.add("shouldSetIsClickableByDefault")
785-
shouldSetIsClickableByDefaultCache = cached
786-
}
787-
return cached
788-
}
789-
790779
override fun shouldTriggerResponderTransferOnScrollAndroid(): Boolean {
791780
var cached = shouldTriggerResponderTransferOnScrollAndroidCache
792781
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<<d6f937b2829cc1f0e49a136aae1044e9>>
7+
* @generated SignedSource<<98babc53e50f8ec8b9e324727ed3734b>>
88
*/
99

1010
/**
@@ -157,8 +157,6 @@ public interface ReactNativeFeatureFlagsProvider {
157157

158158
@DoNotStrip public fun shouldSetEnabledBasedOnAccessibilityState(): Boolean
159159

160-
@DoNotStrip public fun shouldSetIsClickableByDefault(): Boolean
161-
162160
@DoNotStrip public fun shouldTriggerResponderTransferOnScrollAndroid(): Boolean
163161

164162
@DoNotStrip public fun skipActivityIdentityAssertionOnHostPause(): Boolean

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import android.view.ViewGroup;
1717
import android.view.ViewParent;
1818
import android.view.accessibility.AccessibilityEvent;
19-
import android.widget.TextView;
2019
import androidx.annotation.ColorInt;
2120
import androidx.annotation.NonNull;
2221
import androidx.annotation.Nullable;
@@ -156,8 +155,7 @@ public BaseViewManager(@Nullable ReactApplicationContext reactContext) {
156155
view.setOnClickListener(null);
157156
}
158157
if (ReactNativeFeatureFlags.shouldResetClickableWhenRecyclingView()) {
159-
view.setClickable(
160-
ReactNativeFeatureFlags.shouldSetIsClickableByDefault() && !(view instanceof TextView));
158+
view.setClickable(false);
161159
}
162160
view.setFocusable(false);
163161
view.setFocusableInTouchMode(false);
@@ -688,7 +686,6 @@ protected void updateViewAccessibility(@NonNull T view) {
688686
@Override
689687
protected void onAfterUpdateTransaction(@NonNull T view) {
690688
super.onAfterUpdateTransaction(view);
691-
configureClickableState(view);
692689
updateViewAccessibility(view);
693690

694691
Boolean invalidateTransform = (Boolean) view.getTag(R.id.invalidate_transform);
@@ -1022,31 +1019,6 @@ public void setTouchCancel(@NonNull T view, boolean value) {
10221019

10231020
// Please add new props to BaseViewManagerDelegate as well!
10241021

1025-
private static <T extends View> void configureClickableState(@NonNull T view) {
1026-
if (!ReactNativeFeatureFlags.shouldSetIsClickableByDefault()) {
1027-
return;
1028-
}
1029-
1030-
boolean shouldBeClickable;
1031-
if (view instanceof ReactPointerEventsView) {
1032-
shouldBeClickable =
1033-
PointerEvents.canBeTouchTarget(((ReactPointerEventsView) view).getPointerEvents());
1034-
} else if (view instanceof TextView) {
1035-
shouldBeClickable = view.hasOnClickListeners();
1036-
} else {
1037-
shouldBeClickable = true;
1038-
}
1039-
1040-
// NOTE: In Android O+, setClickable(true) has the side effect of setting focusable=true.
1041-
// We need to preserve the original focusable state to respect the focusable prop.
1042-
boolean wasFocusable = view.isFocusable();
1043-
boolean wasFocusableInTouchMode = view.isFocusableInTouchMode();
1044-
1045-
view.setClickable(shouldBeClickable);
1046-
view.setFocusable(wasFocusable);
1047-
view.setFocusableInTouchMode(wasFocusableInTouchMode);
1048-
}
1049-
10501022
/**
10511023
* A helper class to keep track of the original focus change listener if one is set. This is
10521024
* especially helpful for views that are recycled so we can retain and restore the original

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<<4e42a02fba11d92d390e1e60de492214>>
7+
* @generated SignedSource<<3369c6073006f4dddb297f86f413363f>>
88
*/
99

1010
/**
@@ -441,12 +441,6 @@ class ReactNativeFeatureFlagsJavaProvider
441441
return method(javaProvider_);
442442
}
443443

444-
bool shouldSetIsClickableByDefault() override {
445-
static const auto method =
446-
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("shouldSetIsClickableByDefault");
447-
return method(javaProvider_);
448-
}
449-
450444
bool shouldTriggerResponderTransferOnScrollAndroid() override {
451445
static const auto method =
452446
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("shouldTriggerResponderTransferOnScrollAndroid");
@@ -870,11 +864,6 @@ bool JReactNativeFeatureFlagsCxxInterop::shouldSetEnabledBasedOnAccessibilitySta
870864
return ReactNativeFeatureFlags::shouldSetEnabledBasedOnAccessibilityState();
871865
}
872866

873-
bool JReactNativeFeatureFlagsCxxInterop::shouldSetIsClickableByDefault(
874-
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
875-
return ReactNativeFeatureFlags::shouldSetIsClickableByDefault();
876-
}
877-
878867
bool JReactNativeFeatureFlagsCxxInterop::shouldTriggerResponderTransferOnScrollAndroid(
879868
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
880869
return ReactNativeFeatureFlags::shouldTriggerResponderTransferOnScrollAndroid();
@@ -1177,9 +1166,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
11771166
makeNativeMethod(
11781167
"shouldSetEnabledBasedOnAccessibilityState",
11791168
JReactNativeFeatureFlagsCxxInterop::shouldSetEnabledBasedOnAccessibilityState),
1180-
makeNativeMethod(
1181-
"shouldSetIsClickableByDefault",
1182-
JReactNativeFeatureFlagsCxxInterop::shouldSetIsClickableByDefault),
11831169
makeNativeMethod(
11841170
"shouldTriggerResponderTransferOnScrollAndroid",
11851171
JReactNativeFeatureFlagsCxxInterop::shouldTriggerResponderTransferOnScrollAndroid),

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<<51f172946b8ecb5c5d637112237a5b83>>
7+
* @generated SignedSource<<818d29b2da08e64cec4d20e4b541b7cc>>
88
*/
99

1010
/**
@@ -231,9 +231,6 @@ class JReactNativeFeatureFlagsCxxInterop
231231
static bool shouldSetEnabledBasedOnAccessibilityState(
232232
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
233233

234-
static bool shouldSetIsClickableByDefault(
235-
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
236-
237234
static bool shouldTriggerResponderTransferOnScrollAndroid(
238235
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
239236

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<<b58aac8de8af5726c9a415ff389090f7>>
7+
* @generated SignedSource<<97daf46fe8af38d7af4b7241d1d3bc4e>>
88
*/
99

1010
/**
@@ -294,10 +294,6 @@ bool ReactNativeFeatureFlags::shouldSetEnabledBasedOnAccessibilityState() {
294294
return getAccessor().shouldSetEnabledBasedOnAccessibilityState();
295295
}
296296

297-
bool ReactNativeFeatureFlags::shouldSetIsClickableByDefault() {
298-
return getAccessor().shouldSetIsClickableByDefault();
299-
}
300-
301297
bool ReactNativeFeatureFlags::shouldTriggerResponderTransferOnScrollAndroid() {
302298
return getAccessor().shouldTriggerResponderTransferOnScrollAndroid();
303299
}

0 commit comments

Comments
 (0)