fix: respect RTL direction for reader arrow buttons and swipe navigation

Arrow buttons now swap next/previous in RTL mode. Swipe navigation
receives isRTL from parent state instead of creating its own independent
copy, so toggling direction takes effect immediately without reload.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-15 21:24:11 +01:00
parent 2174579cc1
commit d535f9f28e
3 changed files with 5 additions and 4 deletions

View File

@@ -1,18 +1,18 @@
import { useCallback, useRef, useEffect } from "react";
import { useReadingDirection } from "./useReadingDirection";
interface UseTouchNavigationProps {
onPreviousPage: () => void;
onNextPage: () => void;
pswpRef: React.MutableRefObject<unknown>;
isRTL: boolean;
}
export function useTouchNavigation({
onPreviousPage,
onNextPage,
pswpRef,
isRTL,
}: UseTouchNavigationProps) {
const { isRTL } = useReadingDirection();
const touchStartXRef = useRef<number | null>(null);
const touchStartYRef = useRef<number | null>(null);
const isPinchingRef = useRef(false);