Hide nav when keyboard is open
This commit is contained in:
@@ -110,9 +110,10 @@
|
||||
{@render children?.()}
|
||||
|
||||
<!-- a little extra something for ios -->
|
||||
<div class="fixed bottom-0 left-0 right-0 z-nav h-[var(--saib)] bg-base-100 md:hidden"></div>
|
||||
<div class="bottom-nav fixed bottom-0 left-0 right-0 z-nav h-[var(--saib)] bg-base-100 md:hidden">
|
||||
</div>
|
||||
<div
|
||||
class="border-top bottom-sai fixed left-0 right-0 z-nav h-14 border border-base-200 bg-base-100 md:hidden">
|
||||
class="bottom-nav border-top bottom-sai fixed left-0 right-0 z-nav h-14 border border-base-200 bg-base-100 md:hidden">
|
||||
<div class="content-padding-x content-sizing flex justify-between px-2">
|
||||
<div class="flex gap-2 sm:gap-6">
|
||||
<PrimaryNavItem title="Home" href="/home">
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import {Capacitor} from '@capacitor/core'
|
||||
import {Keyboard} from "@capacitor/keyboard"
|
||||
import {noop} from '@welshman/lib'
|
||||
|
||||
export const syncKeyboard = () => {
|
||||
if (!Capacitor.isNativePlatform()) return noop
|
||||
|
||||
const showListener = Keyboard.addListener("keyboardWillShow", () => {
|
||||
document.body.classList.add("keyboard-open")
|
||||
})
|
||||
|
||||
const hideListener = Keyboard.addListener("keyboardWillHide", () => {
|
||||
document.body.classList.remove("keyboard-open")
|
||||
})
|
||||
|
||||
return () => {
|
||||
showListener.then(listener => listener.remove())
|
||||
hideListener.then(listener => listener.remove())
|
||||
document.body.classList.remove("keyboard-open")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user