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