Fix page height on mobile.

Fix keyboard focus on mobile.
This commit is contained in:
Paul
2021-07-03 15:23:29 +01:00
parent 55633219f9
commit f25b488863
5 changed files with 14 additions and 6 deletions

View File

@@ -2,6 +2,7 @@ import { isTouchscreenDevice } from "../lib/isTouchscreenDevice";
import { createGlobalStyle } from "styled-components";
import { connectState } from "../redux/connector";
import { Children } from "../types/Preact";
import { useEffect } from "preact/hooks";
import { createContext } from "preact";
import { Helmet } from "react-helmet";
@@ -126,6 +127,14 @@ function Theme(props: Props) {
...props.options?.custom
};
useEffect(() => {
const resize = () => document.documentElement.style.setProperty('--app-height', `${window.innerHeight}px`);
resize();
window.addEventListener('resize', resize);
return () => window.removeEventListener('resize', resize);
}, []);
return (
<ThemeContext.Provider value={theme}>
<Helmet>