fix: add fallback for initial window size (#1749)
This commit is contained in:
@@ -42,10 +42,19 @@ const getKey = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const setViewportHeight = () => {
|
const setViewportHeight = () => {
|
||||||
document.documentElement.style.setProperty(
|
const currentValue = parseInt(document.documentElement.style.getPropertyValue('--viewport-height'))
|
||||||
'--viewport-height',
|
const newValue = visualViewport && visualViewport.height > 0 ? visualViewport.height : window.innerHeight
|
||||||
`${visualViewport ? visualViewport.height : window.innerHeight}px`,
|
|
||||||
)
|
if (currentValue && !newValue) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!currentValue && !newValue) {
|
||||||
|
document.documentElement.style.setProperty('--viewport-height', '100vh')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
document.documentElement.style.setProperty('--viewport-height', `${newValue}px`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const setDefaultMonospaceFont = (platform?: Platform) => {
|
const setDefaultMonospaceFont = (platform?: Platform) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user