We use the Dimensions api to determine the viewport in useViewport. However, on resize of a browser window the handler for the event listener provides an incorrect width.
When resizing the browser window to a smaller width, temporarily a width is provided that is smaller than the current resized window. Right afterwards the handler seems to be called a second time with the correct width.
If the smaller and larger breakpoint provide different views, this leads to a flickering, because temporarily the wrong viewport is used based on the incorrect width.
This behaviour has been seen on Chrome 117 and react-native-web ~0.18.10.
We use the
Dimensions
api to determine the viewport inuseViewport
. However, on resize of a browser window the handler for the event listener provides an incorrect width.When resizing the browser window to a smaller width, temporarily a width is provided that is smaller than the current resized window. Right afterwards the handler seems to be called a second time with the correct width.
If the smaller and larger breakpoint provide different views, this leads to a flickering, because temporarily the wrong viewport is used based on the incorrect width.
This behaviour has been seen on Chrome 117 and
react-native-web
~0.18.10.