From 10309e44dc725fbb2dfa77e436fac94c22610c88 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Mon, 16 Aug 2021 20:42:00 +0300 Subject: [PATCH] Auth: Prevent refresh when rotating device --- src/components/auth/Auth.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/auth/Auth.tsx b/src/components/auth/Auth.tsx index 3e7898371..6a71dc428 100644 --- a/src/components/auth/Auth.tsx +++ b/src/components/auth/Auth.tsx @@ -6,6 +6,7 @@ import { GlobalActions, GlobalState } from '../../global/types'; import '../../modules/actions/initial'; import { pick } from '../../util/iteratees'; import { PLATFORM_ENV } from '../../util/environment'; +import windowSize from '../../util/windowSize'; import useHistoryBack from '../../hooks/useHistoryBack'; import UiLoader from '../common/UiLoader'; @@ -43,6 +44,15 @@ const Auth: FC = ({ || (isMobile && authState === 'authorizationStateWaitQrCode'), handleChangeAuthorizationMethod, ); + // Prevent refresh when rotating device + useEffect(() => { + windowSize.disableRefresh(); + + return () => { + windowSize.enableRefresh(); + }; + }, []); + switch (authState) { case 'authorizationStateWaitCode': return ;