fix ptr interfering with layout container

This commit is contained in:
k00b 2024-11-18 17:33:45 -06:00
parent 570c842934
commit 5d71e57839
2 changed files with 22 additions and 25 deletions

View File

@ -15,18 +15,16 @@ export default function Layout ({
return (
<>
{seo && <Seo sub={sub} item={item} user={user} />}
<PullToRefresh android> {/* android prop if true disables its native PTR */}
<Navigation sub={sub} />
{contain
? (
<Container as='main' className={`px-sm-0 ${styles.contain}`}>
<Container as={PullToRefresh} className={`px-sm-0 ${styles.contain}`}>
{children}
</Container>
)
: children}
{footer && <Footer links={footerLinks} />}
<NavFooter sub={sub} />
</PullToRefresh>
</>
)
}

View File

@ -4,7 +4,7 @@ import styles from './pull-to-refresh.module.css'
const REFRESH_THRESHOLD = 50
export default function PullToRefresh ({ children, android }) {
export default function PullToRefresh ({ children, android, className }) {
const router = useRouter()
const [pullDistance, setPullDistance] = useState(0)
const [isPWA, setIsPWA] = useState(false)
@ -68,8 +68,8 @@ export default function PullToRefresh ({ children, android }) {
}, [pullDistance])
return (
<div>
<div
<main
className={className}
onTouchStart={handleTouchStart}
onTouchMove={handleTouchMove}
onTouchEnd={handleTouchEnd}
@ -78,7 +78,6 @@ export default function PullToRefresh ({ children, android }) {
{pullMessage}
</p>
{children}
</div>
</div>
</main>
)
}