Skip to content
Merged
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
4 changes: 2 additions & 2 deletions apps/mobile/src/components/RowPressable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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}
</>
Expand Down
8 changes: 5 additions & 3 deletions apps/mobile/src/lib/useHoverGesture.ts
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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);
Expand Down
Loading