| 350 | useLayoutEffect(() => { |
| 351 | let timeout: ReturnType<typeof setTimeout>; |
| 352 | let onResize = () => { |
| 353 | isResizing.current = true; |
| 354 | clearTimeout(timeout); |
| 355 | |
| 356 | timeout = setTimeout(() => { |
| 357 | isResizing.current = false; |
| 358 | }, 500); |
| 359 | |
| 360 | updatePosition(); |
| 361 | }; |
| 362 | |
| 363 | // Only reposition the overlay if a scroll event happens immediately as a result of resize (aka the virtual keyboard has appears) |
| 364 | // We don't want to reposition the overlay if the user has pinch zoomed in and is scrolling the viewport around. |