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 {
80
80
let height ;
81
81
let width ;
82
82
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
+ */
83
90
if ( win . visualViewport ) {
84
91
const visualViewport = win . visualViewport ;
85
92
height = Math . round ( visualViewport . height ) ;
@@ -136,6 +143,10 @@ export default class Dimensions {
136
143
}
137
144
138
145
if ( canUseDOM ) {
146
+ /*
147
+ * Same here as in _update method
148
+ * keeping the previous implementation as fallback
149
+ */
139
150
if ( window . visualViewport ) {
140
151
window . visualViewport . addEventListener ( 'resize' , Dimensions . _update , false ) ;
141
152
} else {
You can’t perform that action at this time.
0 commit comments