Skip to content

Commit

Permalink
Merge pull request #309 from kronostechnologies/refactor/device-context
Browse files Browse the repository at this point in the history
refactor(DeviceContextProvider): revert to innerWidth
  • Loading branch information
maxime-gendron authored Oct 4, 2021
2 parents cdf3f5a + 1b65f87 commit 83360b1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function getContextObject(
}

function setScreenWidth(width: number): void {
Object.defineProperty(window, 'outerWidth', { writable: true, configurable: true, value: width });
Object.defineProperty(window, 'innerWidth', { writable: true, configurable: true, value: width });
}

describe('Device Context Provider', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const DeviceContextProvider: FunctionComponent<DeviceContextProviderProps
const [device, setDevice] = useState<DeviceContextProps>(getDeviceContext(staticDevice));

function handleScreenResize(): void {
const screenWidth = (window.outerWidth || document.documentElement.clientWidth);
const screenWidth = (window.innerWidth || document.documentElement.clientWidth);
const currentDevice = getDevice(screenWidth);

setDevice(getDeviceContext(currentDevice));
Expand Down

0 comments on commit 83360b1

Please sign in to comment.