-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vertical height is wrong when Safari's bottom bar isn't present #30
Comments
+1 |
https://github.com/mvasin/react-div-100vh/blob/master/src/lib/getWindowHeight.js the code checks first for @mvasin would it be an idea to switch the statement in |
Just encountered this issue as well. FWIW, for me it occurs when rotating the device (either a physical one or one in the simulator) to landscape and then back to portrait. Maybe we need a listener on device rotation to recompute? |
Indeed, using That's how it used to be from the beginning, and |
Hi @blimpmason! According to the diff of #22, that should be version |
What's the issue with |
I think I have this issue as well with iOS 15 and it's bottom bar. The height itself is correct and my elements are positioned correctly, but when the bottom address bar disappears, there is empty space at the bottom (for instance when the user scrolls down). |
I also started to have the same issue with iOS 15 @baba43, could someone find a fix for this bug? |
Hi all, I replaced |
The above update is published under version |
Not quite working for me. On iOS 15 Safari when the browser UI gets minimized, even the |
Wow, that looks like contemporary art. |
Give this a shot. Seems to be working for me. const getViewports = () => ({
viewport: {
width: Math.max(
document.documentElement.clientWidth || 0,
window.innerWidth || 0
),
height: Math.max(
document.documentElement.clientHeight || 0,
window.innerHeight || 0
)
},
visualViewport: {
width: window.visualViewport.width,
height: window.visualViewport.height
}
})
const useVisualViewport = () => {
const [state, setState] = useState(getViewports)
useEffect(() => {
const handleResize = () => setState(getViewports)
window.visualViewport.addEventListener('resize', handleResize)
return () =>
window.visualViewport.removeEventListener('resize', handleResize)
}, [])
return state
} |
Hi,
Thanks for creating this component! Its working fine when the bottom menu bar is present, but once you scroll it away, the height is not updated to the correct height.
For example:
The text was updated successfully, but these errors were encountered: