()
| 23 | const vv = window.visualViewport; |
| 24 | |
| 25 | const update = () => { |
| 26 | const fullHeight = window.innerHeight; |
| 27 | const visibleHeight = vv ? vv.height : fullHeight; |
| 28 | const keyboardHeight = Math.max(0, fullHeight - visibleHeight); |
| 29 | setState({ |
| 30 | viewportHeight: visibleHeight, |
| 31 | keyboardHeight, |
| 32 | isKeyboardOpen: keyboardHeight > 50, |
| 33 | }); |
| 34 | }; |
| 35 | |
| 36 | update(); |
| 37 |
no test coverage detected