fix ptr interfering with layout container
This commit is contained in:
parent
570c842934
commit
5d71e57839
|
@ -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}`}>
|
||||
{children}
|
||||
</Container>
|
||||
)
|
||||
: children}
|
||||
{footer && <Footer links={footerLinks} />}
|
||||
<NavFooter sub={sub} />
|
||||
</PullToRefresh>
|
||||
<Navigation sub={sub} />
|
||||
{contain
|
||||
? (
|
||||
<Container as={PullToRefresh} className={`px-sm-0 ${styles.contain}`}>
|
||||
{children}
|
||||
</Container>
|
||||
)
|
||||
: children}
|
||||
{footer && <Footer links={footerLinks} />}
|
||||
<NavFooter sub={sub} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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,17 +68,16 @@ export default function PullToRefresh ({ children, android }) {
|
|||
}, [pullDistance])
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div
|
||||
onTouchStart={handleTouchStart}
|
||||
onTouchMove={handleTouchMove}
|
||||
onTouchEnd={handleTouchEnd}
|
||||
>
|
||||
<p className={`${styles.pullMessage}`} style={{ top: `${Math.max(-20, Math.min(-20 + pullDistance / 2, 5))}px` }}>
|
||||
{pullMessage}
|
||||
</p>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
<main
|
||||
className={className}
|
||||
onTouchStart={handleTouchStart}
|
||||
onTouchMove={handleTouchMove}
|
||||
onTouchEnd={handleTouchEnd}
|
||||
>
|
||||
<p className={`${styles.pullMessage}`} style={{ top: `${Math.max(-20, Math.min(-20 + pullDistance / 2, 5))}px` }}>
|
||||
{pullMessage}
|
||||
</p>
|
||||
{children}
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue