Left Column: Fix auto-hide on tablet layout (#2562)

This commit is contained in:
Alexander Zinchuk 2023-02-13 03:32:30 +01:00
parent b4f388d4a8
commit 5f4ca63148

View File

@ -222,15 +222,16 @@ const Main: FC<OwnProps & StateProps> = ({
console.log('>>> RENDER MAIN'); console.log('>>> RENDER MAIN');
} }
// If you open the chat in the mobile version, switch to the desktop version, close the chat and
// switch back to the mobile version, you get a blank screen
const { isDesktop } = useAppLayout(); const { isDesktop } = useAppLayout();
useEffect(() => { useEffect(() => {
const areColumnsConflicting = isLeftColumnOpen === isMiddleColumnOpen; if (!isLeftColumnOpen && !isMiddleColumnOpen && !isDesktop) {
if (areColumnsConflicting && !isDesktop) { // Always display at least one column
toggleLeftColumn();
} else if (isLeftColumnOpen && isMiddleColumnOpen && isMobile) {
// Can't have two active columns at the same time
toggleLeftColumn(); toggleLeftColumn();
} }
}, [isDesktop, isLeftColumnOpen, isMiddleColumnOpen, toggleLeftColumn]); }, [isDesktop, isLeftColumnOpen, isMiddleColumnOpen, isMobile, toggleLeftColumn]);
useInterval(checkAppVersion, isMasterTab ? APP_OUTDATED_TIMEOUT_MS : undefined, true); useInterval(checkAppVersion, isMasterTab ? APP_OUTDATED_TIMEOUT_MS : undefined, true);