From b9b84c79d5baf9b711618224c98e296bd26482ec Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Mon, 3 Oct 2022 18:52:52 +0530 Subject: [PATCH] fix: resizing in desktop app --- packages/web/src/javascripts/App.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/web/src/javascripts/App.tsx b/packages/web/src/javascripts/App.tsx index d4772b43b..8996a7981 100644 --- a/packages/web/src/javascripts/App.tsx +++ b/packages/web/src/javascripts/App.tsx @@ -26,7 +26,7 @@ declare global { } import { IsWebPlatform, WebAppVersion } from '@/Constants/Version' -import { DesktopManagerInterface, SNLog } from '@standardnotes/snjs' +import { DesktopManagerInterface, Environment, SNLog } from '@standardnotes/snjs' import ApplicationGroupView from './Components/ApplicationGroupView/ApplicationGroupView' import { WebDevice } from './Application/Device/WebDevice' import { StartApplication } from './Application/Device/StartApplication' @@ -60,6 +60,9 @@ const startApplication: StartApplication = async function startApplication( let root: Root const onDestroy = () => { + if (device.environment === Environment.Desktop) { + window.removeEventListener('resize', setViewportHeight) + } window.removeEventListener('orientationchange', setViewportHeight) const rootElement = document.getElementById(ElementIds.RootId) as HTMLElement root.unmount() @@ -76,6 +79,9 @@ const startApplication: StartApplication = async function startApplication( disableIosTextFieldZoom() setViewportHeight() window.addEventListener('orientationchange', setViewportHeight) + if (device.environment === Environment.Desktop) { + window.addEventListener('resize', setViewportHeight) + } root.render(