File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
packages/react-native-web/src/exports/Dimensions Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,13 @@ export default class Dimensions {
8080 let height ;
8181 let width ;
8282
83+ /*
84+ * iOS does not update viewport dimensions on keyboard open/close
85+ * So, we are using window.visualViewport(https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport)
86+ * instead of document.documentElement.clientHeight
87+ * But we are still using document.documentElement.clientWidth as fallback
88+ * because it was requested by the original repo owner
89+ */
8390 if ( win . visualViewport ) {
8491 const visualViewport = win . visualViewport ;
8592 height = Math . round ( visualViewport . height ) ;
@@ -136,6 +143,10 @@ export default class Dimensions {
136143}
137144
138145if ( canUseDOM ) {
146+ /*
147+ * Same here as in _update method
148+ * keeping the previous implementation as fallback
149+ */
139150 if ( window . visualViewport ) {
140151 window . visualViewport . addEventListener ( 'resize' , Dimensions . _update , false ) ;
141152 } else {
You can’t perform that action at this time.
0 commit comments