Skip to content

Commit 04bdebc

Browse files
fabriziocuccimeta-codesync[bot]
authored andcommitted
Remove shouldResetOnClickListenerWhenRecyclingView feature flag (#55118)
Summary: Pull Request resolved: #55118 Changelog: [Android][Fixed] - Reset OnClickListener to null when recycling views to avoid accessibility tools finding views with incorrect state --- This diff removes the `shouldResetOnClickListenerWhenRecyclingView` feature flag since it has been tested in FB4A for a month with `defaultValue: true`. The flag was introduced to reset `OnClickListener` to null when recycling views on Android to avoid accessibility tools finding views with incorrect state after recycling. This behavior is now the default. Changes: - Removed the flag definition from `ReactNativeFeatureFlags.config.js` - Removed the conditional check in `BaseViewManager.java`, now `view.setOnClickListener(null)` is always called unconditionally - Removed the override from `ReactNativeFeatureFlagsOverrides_Facebook_Android.kt` - Regenerated all feature flag files via `js1 featureflags --update` Reviewed By: javache Differential Revision: D90384358 fbshipit-source-id: b870bad57c4ced30bd57b4057b048be88928ae98
1 parent b023830 commit 04bdebc

21 files changed

Lines changed: 36 additions & 154 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<<01a8372ee4b908995e2c70eb7a972a39>>
7+
* @generated SignedSource<<2fe5a4982aef97d3877c9f00d874ee37>>
88
*/
99

1010
/**
@@ -414,12 +414,6 @@ public object ReactNativeFeatureFlags {
414414
@JvmStatic
415415
public fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean = accessor.shouldPressibilityUseW3CPointerEventsForHover()
416416

417-
/**
418-
* Reset OnClickListener to null when recycling views on Android to avoid accessibility tools finding views with incorrect state after recycling.
419-
*/
420-
@JvmStatic
421-
public fun shouldResetOnClickListenerWhenRecyclingView(): Boolean = accessor.shouldResetOnClickListenerWhenRecyclingView()
422-
423417
/**
424418
* Fix BaseViewManager to properly set view.setEnabled() based on accessibilityState.disabled.
425419
*/

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<<397c978a91e1815389ce7162d7ce0181>>
7+
* @generated SignedSource<<7558273a79cd4a0c68f7c47dd54ed119>>
88
*/
99

1010
/**
@@ -84,7 +84,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
8484
private var preparedTextCacheSizeCache: Double? = null
8585
private var preventShadowTreeCommitExhaustionCache: Boolean? = null
8686
private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
87-
private var shouldResetOnClickListenerWhenRecyclingViewCache: Boolean? = null
8887
private var shouldSetEnabledBasedOnAccessibilityStateCache: Boolean? = null
8988
private var shouldTriggerResponderTransferOnScrollAndroidCache: Boolean? = null
9089
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
@@ -677,15 +676,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
677676
return cached
678677
}
679678

680-
override fun shouldResetOnClickListenerWhenRecyclingView(): Boolean {
681-
var cached = shouldResetOnClickListenerWhenRecyclingViewCache
682-
if (cached == null) {
683-
cached = ReactNativeFeatureFlagsCxxInterop.shouldResetOnClickListenerWhenRecyclingView()
684-
shouldResetOnClickListenerWhenRecyclingViewCache = cached
685-
}
686-
return cached
687-
}
688-
689679
override fun shouldSetEnabledBasedOnAccessibilityState(): Boolean {
690680
var cached = shouldSetEnabledBasedOnAccessibilityStateCache
691681
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<<4f4cfab3f3d91fba4ea661a17dca0cb9>>
7+
* @generated SignedSource<<b41bdf33f0a9d878376a29c39222c808>>
88
*/
99

1010
/**
@@ -156,8 +156,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
156156

157157
@DoNotStrip @JvmStatic public external fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean
158158

159-
@DoNotStrip @JvmStatic public external fun shouldResetOnClickListenerWhenRecyclingView(): Boolean
160-
161159
@DoNotStrip @JvmStatic public external fun shouldSetEnabledBasedOnAccessibilityState(): Boolean
162160

163161
@DoNotStrip @JvmStatic public external fun shouldTriggerResponderTransferOnScrollAndroid(): 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<<c6f0c4d72a9ef24f5352976996a5e300>>
7+
* @generated SignedSource<<5c0d05705dae0f5accff59c1b51d77db>>
88
*/
99

1010
/**
@@ -151,8 +151,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
151151

152152
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean = false
153153

154-
override fun shouldResetOnClickListenerWhenRecyclingView(): Boolean = true
155-
156154
override fun shouldSetEnabledBasedOnAccessibilityState(): Boolean = true
157155

158156
override fun shouldTriggerResponderTransferOnScrollAndroid(): 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<<77669091f5fbd91a7be1693375163c0c>>
7+
* @generated SignedSource<<5e318e662ea5a25be4a5e7e45fe9f967>>
88
*/
99

1010
/**
@@ -88,7 +88,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
8888
private var preparedTextCacheSizeCache: Double? = null
8989
private var preventShadowTreeCommitExhaustionCache: Boolean? = null
9090
private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
91-
private var shouldResetOnClickListenerWhenRecyclingViewCache: Boolean? = null
9291
private var shouldSetEnabledBasedOnAccessibilityStateCache: Boolean? = null
9392
private var shouldTriggerResponderTransferOnScrollAndroidCache: Boolean? = null
9493
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
@@ -745,16 +744,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
745744
return cached
746745
}
747746

748-
override fun shouldResetOnClickListenerWhenRecyclingView(): Boolean {
749-
var cached = shouldResetOnClickListenerWhenRecyclingViewCache
750-
if (cached == null) {
751-
cached = currentProvider.shouldResetOnClickListenerWhenRecyclingView()
752-
accessedFeatureFlags.add("shouldResetOnClickListenerWhenRecyclingView")
753-
shouldResetOnClickListenerWhenRecyclingViewCache = cached
754-
}
755-
return cached
756-
}
757-
758747
override fun shouldSetEnabledBasedOnAccessibilityState(): Boolean {
759748
var cached = shouldSetEnabledBasedOnAccessibilityStateCache
760749
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<<da8de211c4b7837291853f9b79d2f8e5>>
7+
* @generated SignedSource<<672f9916bd65231de961c3a945abf84e>>
88
*/
99

1010
/**
@@ -151,8 +151,6 @@ public interface ReactNativeFeatureFlagsProvider {
151151

152152
@DoNotStrip public fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean
153153

154-
@DoNotStrip public fun shouldResetOnClickListenerWhenRecyclingView(): Boolean
155-
156154
@DoNotStrip public fun shouldSetEnabledBasedOnAccessibilityState(): Boolean
157155

158156
@DoNotStrip public fun shouldTriggerResponderTransferOnScrollAndroid(): Boolean

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,7 @@ public BaseViewManager(@Nullable ReactApplicationContext reactContext) {
151151

152152
// NOTE: setClickable MUST be called AFTER setOnClickListener because
153153
// the latter has the side effect of setting isClickable=true on some views!
154-
if (ReactNativeFeatureFlags.shouldResetOnClickListenerWhenRecyclingView()) {
155-
view.setOnClickListener(null);
156-
}
154+
view.setOnClickListener(null);
157155
view.setClickable(false);
158156
view.setFocusable(false);
159157
view.setFocusableInTouchMode(false);

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<<212a64efdf912e89b8330b292a8bccb5>>
7+
* @generated SignedSource<<fb3fcd12e6e8fd496d90be50f5f06c70>>
88
*/
99

1010
/**
@@ -423,12 +423,6 @@ class ReactNativeFeatureFlagsJavaProvider
423423
return method(javaProvider_);
424424
}
425425

426-
bool shouldResetOnClickListenerWhenRecyclingView() override {
427-
static const auto method =
428-
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("shouldResetOnClickListenerWhenRecyclingView");
429-
return method(javaProvider_);
430-
}
431-
432426
bool shouldSetEnabledBasedOnAccessibilityState() override {
433427
static const auto method =
434428
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("shouldSetEnabledBasedOnAccessibilityState");
@@ -843,11 +837,6 @@ bool JReactNativeFeatureFlagsCxxInterop::shouldPressibilityUseW3CPointerEventsFo
843837
return ReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover();
844838
}
845839

846-
bool JReactNativeFeatureFlagsCxxInterop::shouldResetOnClickListenerWhenRecyclingView(
847-
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
848-
return ReactNativeFeatureFlags::shouldResetOnClickListenerWhenRecyclingView();
849-
}
850-
851840
bool JReactNativeFeatureFlagsCxxInterop::shouldSetEnabledBasedOnAccessibilityState(
852841
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
853842
return ReactNativeFeatureFlags::shouldSetEnabledBasedOnAccessibilityState();
@@ -1146,9 +1135,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
11461135
makeNativeMethod(
11471136
"shouldPressibilityUseW3CPointerEventsForHover",
11481137
JReactNativeFeatureFlagsCxxInterop::shouldPressibilityUseW3CPointerEventsForHover),
1149-
makeNativeMethod(
1150-
"shouldResetOnClickListenerWhenRecyclingView",
1151-
JReactNativeFeatureFlagsCxxInterop::shouldResetOnClickListenerWhenRecyclingView),
11521138
makeNativeMethod(
11531139
"shouldSetEnabledBasedOnAccessibilityState",
11541140
JReactNativeFeatureFlagsCxxInterop::shouldSetEnabledBasedOnAccessibilityState),

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<<010228a95e878a109f1aa3d13a0c7606>>
7+
* @generated SignedSource<<3b35756e1d6e07f3ef9e3cb495022266>>
88
*/
99

1010
/**
@@ -222,9 +222,6 @@ class JReactNativeFeatureFlagsCxxInterop
222222
static bool shouldPressibilityUseW3CPointerEventsForHover(
223223
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
224224

225-
static bool shouldResetOnClickListenerWhenRecyclingView(
226-
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
227-
228225
static bool shouldSetEnabledBasedOnAccessibilityState(
229226
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
230227

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<<8fa338ec73fcb7af019d877fd949543a>>
7+
* @generated SignedSource<<0b2eb9cd4cd22a91a645c205ac7c3845>>
88
*/
99

1010
/**
@@ -282,10 +282,6 @@ bool ReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover() {
282282
return getAccessor().shouldPressibilityUseW3CPointerEventsForHover();
283283
}
284284

285-
bool ReactNativeFeatureFlags::shouldResetOnClickListenerWhenRecyclingView() {
286-
return getAccessor().shouldResetOnClickListenerWhenRecyclingView();
287-
}
288-
289285
bool ReactNativeFeatureFlags::shouldSetEnabledBasedOnAccessibilityState() {
290286
return getAccessor().shouldSetEnabledBasedOnAccessibilityState();
291287
}

0 commit comments

Comments
 (0)