StackedRouter: new router simulates app behaviour #45
1 changed files with 8 additions and 0 deletions
|
@ -10,6 +10,7 @@ import { Refresh as RefreshIcon } from "@suid/icons-material";
|
||||||
import { CircularProgress } from "@suid/material";
|
import { CircularProgress } from "@suid/material";
|
||||||
import { makeEventListener } from "@solid-primitives/event-listener";
|
import { makeEventListener } from "@solid-primitives/event-listener";
|
||||||
import { createVisibilityObserver } from "@solid-primitives/intersection-observer";
|
import { createVisibilityObserver } from "@solid-primitives/intersection-observer";
|
||||||
|
import { useMaybeIsFrameSuspended } from "../platform/StackedRouter";
|
||||||
|
|
||||||
const PullDownToRefresh: Component<{
|
const PullDownToRefresh: Component<{
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
|
@ -33,6 +34,7 @@ const PullDownToRefresh: Component<{
|
||||||
});
|
});
|
||||||
|
|
||||||
const rootVisible = obvx(() => rootElement);
|
const rootVisible = obvx(() => rootElement);
|
||||||
|
const isFrameSuspended = useMaybeIsFrameSuspended()
|
||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
if (!rootVisible()) setPullDown(0);
|
if (!rootVisible()) setPullDown(0);
|
||||||
|
@ -109,6 +111,9 @@ const PullDownToRefresh: Component<{
|
||||||
if (!rootVisible()) {
|
if (!rootVisible()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (isFrameSuspended()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const element = props.linkedElement;
|
const element = props.linkedElement;
|
||||||
if (!element) return;
|
if (!element) return;
|
||||||
makeEventListener(element, "wheel", handleLinkedWheel);
|
makeEventListener(element, "wheel", handleLinkedWheel);
|
||||||
|
@ -159,6 +164,9 @@ const PullDownToRefresh: Component<{
|
||||||
if (!rootVisible()) {
|
if (!rootVisible()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (isFrameSuspended()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const element = props.linkedElement;
|
const element = props.linkedElement;
|
||||||
if (!element) return;
|
if (!element) return;
|
||||||
makeEventListener(element, "touchmove", handleTouch);
|
makeEventListener(element, "touchmove", handleTouch);
|
||||||
|
|
Loading…
Reference in a new issue