Skip to content

Commit

Permalink
Multiplied measures to visual viewport scale
Browse files Browse the repository at this point in the history
  • Loading branch information
alitoshmatov committed May 10, 2023
1 parent bb2f765 commit e8daccd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/react-native-web/src/exports/Dimensions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,15 @@ function update() {
*/
if (win.visualViewport) {
const visualViewport = win.visualViewport;
height = Math.round(visualViewport.height);
width = Math.round(visualViewport.width);
/**
* We are multiplying by scale because height and width from visual viewport
* also react to pinch zoom, and become smaller when zoomed. But it is not desired
* behaviour, since originally documentElement client height and width were used,
* and they do not react to pinch zoom. We had an issue where layouts were adopting to smaller measures
* when pinch zoomed. context - https://github.com/Expensify/App/issues/17246
*/
height = Math.round(visualViewport.height * visualViewport.scale);
width = Math.round(visualViewport.width * visualViewport.scale);
} else {
const docEl = win.document.documentElement;
height = docEl.clientHeight;
Expand Down

0 comments on commit e8daccd

Please sign in to comment.