Safe area provider

This commit is contained in:
Max Lynch
2020-12-22 13:15:15 -06:00
parent fc7b7649d3
commit 36b3fb8de0
4 changed files with 52 additions and 34 deletions
-18
View File
@@ -7,24 +7,6 @@ import Store from '../store';
import '../styles/global.css';
function MyApp({ Component, pageProps }) {
useEffect(() => {
// I don't know why, but we can't get the value of this CSS variable
// until a bit of a delay, maybe something with Next?
setTimeout(() => {
const safeAreaTop = parseInt(
window.getComputedStyle(document.documentElement).getPropertyValue('--safe-area-top')
);
const safeAreaBottom = window
.getComputedStyle(document.documentElement)
.getPropertyValue('--safe-area-bottom');
Store.update(s => {
s.safeAreaTop = safeAreaTop;
s.safeAreaBottom = safeAreaBottom;
});
}, 500);
}, []);
return (
<>
<Head>