Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<f65e9c6c5c404c0db2fe537917b27557>>
* @generated SignedSource<<b9a49024788f6d78e8bce1d8d7a00f16>>
*/

/**
Expand Down Expand Up @@ -432,12 +432,6 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun shouldSetEnabledBasedOnAccessibilityState(): Boolean = accessor.shouldSetEnabledBasedOnAccessibilityState()

/**
* 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.
*/
@JvmStatic
public fun shouldSetIsClickableByDefault(): Boolean = accessor.shouldSetIsClickableByDefault()

/**
* Do not emit touchcancel from Android ScrollView, instead native topScroll event will trigger responder transfer and terminate in RN renderer.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<907fd6d60faaeb4c28ffd3b40928347e>>
* @generated SignedSource<<a45409be422bc544a43295eb4fe21074>>
*/

/**
Expand Down Expand Up @@ -87,7 +87,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var shouldResetClickableWhenRecyclingViewCache: Boolean? = null
private var shouldResetOnClickListenerWhenRecyclingViewCache: Boolean? = null
private var shouldSetEnabledBasedOnAccessibilityStateCache: Boolean? = null
private var shouldSetIsClickableByDefaultCache: Boolean? = null
private var shouldTriggerResponderTransferOnScrollAndroidCache: Boolean? = null
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
Expand Down Expand Up @@ -706,15 +705,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}

override fun shouldSetIsClickableByDefault(): Boolean {
var cached = shouldSetIsClickableByDefaultCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.shouldSetIsClickableByDefault()
shouldSetIsClickableByDefaultCache = cached
}
return cached
}

override fun shouldTriggerResponderTransferOnScrollAndroid(): Boolean {
var cached = shouldTriggerResponderTransferOnScrollAndroidCache
if (cached == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<497416e09c55455dccb439c15955ee00>>
* @generated SignedSource<<645d8233955b21a3b2d4e822976abd35>>
*/

/**
Expand Down Expand Up @@ -162,8 +162,6 @@ public object ReactNativeFeatureFlagsCxxInterop {

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

@DoNotStrip @JvmStatic public external fun shouldSetIsClickableByDefault(): Boolean

@DoNotStrip @JvmStatic public external fun shouldTriggerResponderTransferOnScrollAndroid(): Boolean

@DoNotStrip @JvmStatic public external fun skipActivityIdentityAssertionOnHostPause(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<26eb9af61fedaacaadc23a8698ff6117>>
* @generated SignedSource<<d08d1352bfe98e3e84e58ab9ad2e70c6>>
*/

/**
Expand Down Expand Up @@ -157,8 +157,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi

override fun shouldSetEnabledBasedOnAccessibilityState(): Boolean = true

override fun shouldSetIsClickableByDefault(): Boolean = false

override fun shouldTriggerResponderTransferOnScrollAndroid(): Boolean = false

override fun skipActivityIdentityAssertionOnHostPause(): Boolean = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<a1aced60121b0dc49c55b2141a331cf2>>
* @generated SignedSource<<5ad99dd8a367e7f12d68c9ef1a52cb56>>
*/

/**
Expand Down Expand Up @@ -91,7 +91,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var shouldResetClickableWhenRecyclingViewCache: Boolean? = null
private var shouldResetOnClickListenerWhenRecyclingViewCache: Boolean? = null
private var shouldSetEnabledBasedOnAccessibilityStateCache: Boolean? = null
private var shouldSetIsClickableByDefaultCache: Boolean? = null
private var shouldTriggerResponderTransferOnScrollAndroidCache: Boolean? = null
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
Expand Down Expand Up @@ -777,16 +776,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}

override fun shouldSetIsClickableByDefault(): Boolean {
var cached = shouldSetIsClickableByDefaultCache
if (cached == null) {
cached = currentProvider.shouldSetIsClickableByDefault()
accessedFeatureFlags.add("shouldSetIsClickableByDefault")
shouldSetIsClickableByDefaultCache = cached
}
return cached
}

override fun shouldTriggerResponderTransferOnScrollAndroid(): Boolean {
var cached = shouldTriggerResponderTransferOnScrollAndroidCache
if (cached == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<d6f937b2829cc1f0e49a136aae1044e9>>
* @generated SignedSource<<98babc53e50f8ec8b9e324727ed3734b>>
*/

/**
Expand Down Expand Up @@ -157,8 +157,6 @@ public interface ReactNativeFeatureFlagsProvider {

@DoNotStrip public fun shouldSetEnabledBasedOnAccessibilityState(): Boolean

@DoNotStrip public fun shouldSetIsClickableByDefault(): Boolean

@DoNotStrip public fun shouldTriggerResponderTransferOnScrollAndroid(): Boolean

@DoNotStrip public fun skipActivityIdentityAssertionOnHostPause(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.widget.TextView;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand Down Expand Up @@ -156,8 +155,7 @@ public BaseViewManager(@Nullable ReactApplicationContext reactContext) {
view.setOnClickListener(null);
}
if (ReactNativeFeatureFlags.shouldResetClickableWhenRecyclingView()) {
view.setClickable(
ReactNativeFeatureFlags.shouldSetIsClickableByDefault() && !(view instanceof TextView));
view.setClickable(false);
}
view.setFocusable(false);
view.setFocusableInTouchMode(false);
Expand Down Expand Up @@ -688,7 +686,6 @@ protected void updateViewAccessibility(@NonNull T view) {
@Override
protected void onAfterUpdateTransaction(@NonNull T view) {
super.onAfterUpdateTransaction(view);
configureClickableState(view);
updateViewAccessibility(view);

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

// Please add new props to BaseViewManagerDelegate as well!

private static <T extends View> void configureClickableState(@NonNull T view) {
if (!ReactNativeFeatureFlags.shouldSetIsClickableByDefault()) {
return;
}

boolean shouldBeClickable;
if (view instanceof ReactPointerEventsView) {
shouldBeClickable =
PointerEvents.canBeTouchTarget(((ReactPointerEventsView) view).getPointerEvents());
} else if (view instanceof TextView) {
shouldBeClickable = view.hasOnClickListeners();
} else {
shouldBeClickable = true;
}

// NOTE: In Android O+, setClickable(true) has the side effect of setting focusable=true.
// We need to preserve the original focusable state to respect the focusable prop.
boolean wasFocusable = view.isFocusable();
boolean wasFocusableInTouchMode = view.isFocusableInTouchMode();

view.setClickable(shouldBeClickable);
view.setFocusable(wasFocusable);
view.setFocusableInTouchMode(wasFocusableInTouchMode);
}

/**
* A helper class to keep track of the original focus change listener if one is set. This is
* especially helpful for views that are recycled so we can retain and restore the original
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<4e42a02fba11d92d390e1e60de492214>>
* @generated SignedSource<<3369c6073006f4dddb297f86f413363f>>
*/

/**
Expand Down Expand Up @@ -441,12 +441,6 @@ class ReactNativeFeatureFlagsJavaProvider
return method(javaProvider_);
}

bool shouldSetIsClickableByDefault() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("shouldSetIsClickableByDefault");
return method(javaProvider_);
}

bool shouldTriggerResponderTransferOnScrollAndroid() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("shouldTriggerResponderTransferOnScrollAndroid");
Expand Down Expand Up @@ -870,11 +864,6 @@ bool JReactNativeFeatureFlagsCxxInterop::shouldSetEnabledBasedOnAccessibilitySta
return ReactNativeFeatureFlags::shouldSetEnabledBasedOnAccessibilityState();
}

bool JReactNativeFeatureFlagsCxxInterop::shouldSetIsClickableByDefault(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::shouldSetIsClickableByDefault();
}

bool JReactNativeFeatureFlagsCxxInterop::shouldTriggerResponderTransferOnScrollAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::shouldTriggerResponderTransferOnScrollAndroid();
Expand Down Expand Up @@ -1177,9 +1166,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"shouldSetEnabledBasedOnAccessibilityState",
JReactNativeFeatureFlagsCxxInterop::shouldSetEnabledBasedOnAccessibilityState),
makeNativeMethod(
"shouldSetIsClickableByDefault",
JReactNativeFeatureFlagsCxxInterop::shouldSetIsClickableByDefault),
makeNativeMethod(
"shouldTriggerResponderTransferOnScrollAndroid",
JReactNativeFeatureFlagsCxxInterop::shouldTriggerResponderTransferOnScrollAndroid),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<51f172946b8ecb5c5d637112237a5b83>>
* @generated SignedSource<<818d29b2da08e64cec4d20e4b541b7cc>>
*/

/**
Expand Down Expand Up @@ -231,9 +231,6 @@ class JReactNativeFeatureFlagsCxxInterop
static bool shouldSetEnabledBasedOnAccessibilityState(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static bool shouldSetIsClickableByDefault(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static bool shouldTriggerResponderTransferOnScrollAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<b58aac8de8af5726c9a415ff389090f7>>
* @generated SignedSource<<97daf46fe8af38d7af4b7241d1d3bc4e>>
*/

/**
Expand Down Expand Up @@ -294,10 +294,6 @@ bool ReactNativeFeatureFlags::shouldSetEnabledBasedOnAccessibilityState() {
return getAccessor().shouldSetEnabledBasedOnAccessibilityState();
}

bool ReactNativeFeatureFlags::shouldSetIsClickableByDefault() {
return getAccessor().shouldSetIsClickableByDefault();
}

bool ReactNativeFeatureFlags::shouldTriggerResponderTransferOnScrollAndroid() {
return getAccessor().shouldTriggerResponderTransferOnScrollAndroid();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<6c608c49510a61153dd2c5c3e659930d>>
* @generated SignedSource<<4f7b218e3a60fd7877e46f04e9c084eb>>
*/

/**
Expand Down Expand Up @@ -374,11 +374,6 @@ class ReactNativeFeatureFlags {
*/
RN_EXPORT static bool shouldSetEnabledBasedOnAccessibilityState();

/**
* 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.
*/
RN_EXPORT static bool shouldSetIsClickableByDefault();

/**
* Do not emit touchcancel from Android ScrollView, instead native topScroll event will trigger responder transfer and terminate in RN renderer.
*/
Expand Down
Loading
Loading