The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import { useState } from "react"; |
| 2 | import { Gesture, PointerType } from "react-native-gesture-handler"; |
| 3 | |
| 4 | export function useHoverGesture(disabled = false) { |
| 5 | const [hovered, setHovered] = useState(false); |
| 6 | // oxlint-disable-next-line react/capitalized-calls -- Gesture.Hover is a gesture factory, not a React component. |
| 7 | const hoverGesture = Gesture.Hover() |
| 8 | .manualActivation(true) |
| 9 | .enabled(!disabled) |
| 10 | .cancelsTouchesInView(false) |
| 11 | .runOnJS(true) |
| 12 | .onBegin((event) => { |
| 13 | setHovered( |
| 14 | event.pointerType === PointerType.MOUSE || event.pointerType === PointerType.STYLUS, |
| 15 | ); |
| 16 | }) |
| 17 | .onFinalize(() => { |
| 18 | setHovered(false); |
| 19 | }); |
| 20 | return { hovered: !disabled && hovered, hoverGesture }; |
| 21 | } |