StackedRouter: prevent ios default swipe to back
All checks were successful
/ depoly (push) Successful in 1m22s

This commit is contained in:
thislight 2024-11-18 21:42:40 +08:00
parent 1a7a52da22
commit 9065a18061
No known key found for this signature in database
GPG key ID: FCFE5192241CCD4E

View file

@ -15,9 +15,7 @@ import { createStore, unwrap } from "solid-js/store";
import "./StackedRouter.css"; import "./StackedRouter.css";
import { animateSlideInFromRight, animateSlideOutToRight } from "./anim"; import { animateSlideInFromRight, animateSlideOutToRight } from "./anim";
import { ANIM_CURVE_DECELERATION, ANIM_CURVE_STD } from "../material/theme"; import { ANIM_CURVE_DECELERATION, ANIM_CURVE_STD } from "../material/theme";
import { import { makeEventListener } from "@solid-primitives/event-listener";
makeEventListener,
} from "@solid-primitives/event-listener";
export type StackedRouterProps = Omit<RouterProps, "url">; export type StackedRouterProps = Omit<RouterProps, "url">;
@ -314,6 +312,9 @@ const StackedRouter: Component<StackedRouterProps> = (oprops) => {
origX = x; origX = x;
origWidth = width; origWidth = width;
event.preventDefault();
event.stopPropagation();
const lastFr = stack[stack.length - 1]; const lastFr = stack[stack.length - 1];
const createAnimation = lastFr.animateClose ?? animateClose; const createAnimation = lastFr.animateClose ?? animateClose;
reenterableAnimation = createAnimation(event.currentTarget); reenterableAnimation = createAnimation(event.currentTarget);