diff --git a/src/components/crapp/BarraSottosezioni.tsx b/src/components/crapp/BarraSottosezioni.tsx index fa2988c..a919737 100644 --- a/src/components/crapp/BarraSottosezioni.tsx +++ b/src/components/crapp/BarraSottosezioni.tsx @@ -1,7 +1,8 @@ import { useEffect, useRef, useState, type ReactNode } from "react"; -import { motion, useReducedMotion } from "motion/react"; +import { motion } from "motion/react"; import { cn } from "@/lib/utils"; import { proietta } from "@/lib/molla"; +import { useMotoRidotto } from "@/lib/motion"; export type VoceSottosezione = { id: string; @@ -38,7 +39,11 @@ export function BarraSottosezioni({ const [attiva, setAttiva] = useState(defaultId ?? voci[0]?.id ?? ""); const direzione = useRef(0); const tabRefs = useRef>({}); - const ridotto = useReducedMotion(); + // `useMotoRidotto` copre anche i device deboli (RAM bassa), non solo + // `prefers-reduced-motion`: qui disattiva sia lo swipe orizzontale sia il + // blur della barra tab, i due costi maggiori all'ingresso in una pagina con + // sottosezioni (Squadra, Campionato, Profilo). + const ridotto = useMotoRidotto(); const indice = Math.max( 0, voci.findIndex((v) => v.id === attiva), @@ -69,7 +74,8 @@ export function BarraSottosezioni({
{/* Solo la barra tab può scrollare in orizzontale: non allarga il layout pagina. */} @@ -136,7 +142,9 @@ export function BarraSottosezioni({ key={voce.id} role="tabpanel" aria-label={voce.label} - drag="x" + // Sui device deboli lo swipe orizzontale (pointer listener + hit-testing + // ad ogni frame) resta disattivato: si cambia tab solo toccando la barra. + drag={ridotto ? false : "x"} dragConstraints={{ left: 0, right: 0 }} dragElastic={0.12} dragMomentum={false} diff --git a/src/components/crapp/BottomNav.tsx b/src/components/crapp/BottomNav.tsx index 90239fc..ea6f57f 100644 --- a/src/components/crapp/BottomNav.tsx +++ b/src/components/crapp/BottomNav.tsx @@ -1,7 +1,8 @@ import { Link } from "@tanstack/react-router"; import { CalendarDays, Home, Trophy, Users } from "lucide-react"; -import { motion, useReducedMotion } from "motion/react"; +import { motion } from "motion/react"; import { molla } from "@/lib/molla"; +import { useMotoRidotto } from "@/lib/motion"; // Quattro voci e non cinque: il profilo sta in alto a destra // nell'intestazione di ogni pagina, dove lo cerca chi arriva da iOS. @@ -13,7 +14,10 @@ const items = [ ] as const; export function BottomNav() { - const ridotto = useReducedMotion(); + // `useMotoRidotto` copre anche i device deboli (RAM bassa), non solo + // `prefers-reduced-motion`: qui disattiva sia la molla della capsula sia il + // vetro sfocato, i due costi maggiori ad ogni cambio di rotta. + const ridotto = useMotoRidotto(); return (