fix(mobile): restrict row highlighting to pointer input (#11863)

This commit is contained in:
Julius Marminge authored and GitHub committed 2026-09-15 00:12:22 -07:00
1 parent 9ea892e3b3
commit 6ecc15fa25
2 files changed
+7 -5

No files matched your search

+2 -2
View File
@@ -5,7 +5,7 @@ import { GestureDetector } from "react-native-gesture-handler";
import { cn } from "../lib/cn";
import { useHoverGesture } from "../lib/useHoverGesture";
/** Shared row feedback, layered over the background so selection stays visible. */
/** Pointer feedback layered over selection. Touch-down may be the start of a scroll. */
export function RowPressable({
children,
className,
@@ -24,7 +24,7 @@ export function RowPressable({
<View
pointerEvents="none"
className={cn("absolute inset-0", interactionClassName)}
style={{ opacity: props.disabled ? 0 : pressed ? 0.2 : hovered ? 0.1 : 0 }}
style={{ opacity: props.disabled || !hovered ? 0 : pressed ? 0.2 : 0.1 }}
/>
{children}
</>
+5 -3
View File
@@ -1,5 +1,5 @@
import { useMemo, useState } from "react";
import { Gesture } from "react-native-gesture-handler";
import { Gesture, PointerType } from "react-native-gesture-handler";
/** Uses native hover recognition without React Native's optional pointer-event flags. */
export function useHoverGesture(disabled = false) {
@@ -12,8 +12,10 @@ export function useHoverGesture(disabled = false) {
// Observe hover without competing with row taps, scrolling, or swipe actions.
.cancelsTouchesInView(false)
.runOnJS(true)
.onBegin(() => {
setHovered(true);
.onBegin((event) => {
setHovered(
event.pointerType === PointerType.MOUSE || event.pointerType === PointerType.STYLUS,
);
})
.onFinalize(() => {
setHovered(false);