Middle Header: Fix back button gets stuck (#1458)
This commit is contained in:
parent
e3f392cc7a
commit
8c11614415
@ -186,6 +186,12 @@ const MiddleHeader: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
openChat({ id: chatId, threadId: MAIN_THREAD_ID, type: 'pinned' });
|
openChat({ id: chatId, threadId: MAIN_THREAD_ID, type: 'pinned' });
|
||||||
}, [openChat, chatId]);
|
}, [openChat, chatId]);
|
||||||
|
|
||||||
|
const setBackButtonActive = useCallback(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
isBackButtonActive.current = true;
|
||||||
|
}, BACK_BUTTON_INACTIVE_TIME);
|
||||||
|
}, []);
|
||||||
|
|
||||||
const handleBackClick = useCallback((e: React.MouseEvent<HTMLElement, MouseEvent>) => {
|
const handleBackClick = useCallback((e: React.MouseEvent<HTMLElement, MouseEvent>) => {
|
||||||
if (!isBackButtonActive.current) return;
|
if (!isBackButtonActive.current) return;
|
||||||
|
|
||||||
@ -200,6 +206,7 @@ const MiddleHeader: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
|
|
||||||
if (isSelectModeActive) {
|
if (isSelectModeActive) {
|
||||||
exitMessageSelectMode();
|
exitMessageSelectMode();
|
||||||
|
setBackButtonActive();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,16 +218,16 @@ const MiddleHeader: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
toggleLeftColumn();
|
toggleLeftColumn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setBackButtonActive();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
openPreviousChat();
|
openPreviousChat();
|
||||||
setTimeout(() => {
|
setBackButtonActive();
|
||||||
isBackButtonActive.current = true;
|
|
||||||
}, BACK_BUTTON_INACTIVE_TIME);
|
|
||||||
}, [
|
}, [
|
||||||
threadId, messageListType, currentTransitionKey, isSelectModeActive, openPreviousChat, shouldShowCloseButton,
|
threadId, messageListType, currentTransitionKey, isSelectModeActive, openPreviousChat, shouldShowCloseButton,
|
||||||
openChat, toggleLeftColumn, exitMessageSelectMode,
|
openChat, toggleLeftColumn, exitMessageSelectMode, setBackButtonActive,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const unreadCount = useMemo(() => {
|
const unreadCount = useMemo(() => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user