mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-18 12:49:24 +00:00
89cf78d529
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
22 lines
560 B
JavaScript
22 lines
560 B
JavaScript
/* eslint-env jasmine, jest */
|
|
|
|
// JSDOM doesn't implement ResizeObserver
|
|
class ResizeObserver {
|
|
disconnect() {}
|
|
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;
|
|
}
|
|
});
|