mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-23 23:06:24 +00:00
[change] Fix the Dimensions.window value
Fixes issues in Safari from using window.innerWidth. Using documentElement.clientWidth doesn't have issues and provides a more practical value for the canvas width that excludes the width of scrollbars. Fix #1369 Fix #1905
This commit is contained in:
@@ -6,5 +6,16 @@ class ResizeObserver {
|
||||
observe() {}
|
||||
unobserve() {}
|
||||
}
|
||||
|
||||
window.ResizeObserver = ResizeObserver;
|
||||
|
||||
// JSDOM doesn't provide values for 'clientWidth' etc
|
||||
Object.defineProperty(window.document.documentElement, 'clientHeight', {
|
||||
get: function () {
|
||||
return this._jsdomClientWidth || window.innerHeight;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(window.document.documentElement, 'clientWidth', {
|
||||
get: function () {
|
||||
return this._jsdomClientWidth || window.innerWidth;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user