Auth: Prevent refresh when rotating device

This commit is contained in:
Alexander Zinchuk 2021-08-16 20:42:00 +03:00
parent e39a63aa73
commit 10309e44dc

View File

@ -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<StateProps & DispatchProps> = ({
|| (isMobile && authState === 'authorizationStateWaitQrCode'), handleChangeAuthorizationMethod,
);
// Prevent refresh when rotating device
useEffect(() => {
windowSize.disableRefresh();
return () => {
windowSize.enableRefresh();
};
}, []);
switch (authState) {
case 'authorizationStateWaitCode':
return <UiLoader page="authCode" key="authCode"><AuthCode /></UiLoader>;