mirror of
https://github.com/danog/telegram-tt.git
synced 2025-01-22 05:11:55 +01:00
Chat Folders: Support <Esc> key to return to "All" tab
This commit is contained in:
parent
ab448de3d4
commit
776a60c363
@ -14,6 +14,7 @@ import useShowTransition from '../../../hooks/useShowTransition';
|
||||
import buildClassName from '../../../util/buildClassName';
|
||||
import useThrottledMemo from '../../../hooks/useThrottledMemo';
|
||||
import useLang from '../../../hooks/useLang';
|
||||
import captureEscKeyListener from '../../../util/captureEscKeyListener';
|
||||
|
||||
import Transition from '../../ui/Transition';
|
||||
import TabList from '../../ui/TabList';
|
||||
@ -122,6 +123,14 @@ const ChatFolders: FC<StateProps & DispatchProps> = ({
|
||||
});
|
||||
}, [activeTab, folderTabs]);
|
||||
|
||||
const isNotInAllTabRef = useRef();
|
||||
isNotInAllTabRef.current = activeTab !== 0;
|
||||
useEffect(() => captureEscKeyListener(() => {
|
||||
if (isNotInAllTabRef.current) {
|
||||
setActiveTab(0);
|
||||
}
|
||||
}), []);
|
||||
|
||||
const {
|
||||
shouldRender: shouldRenderPlaceholder, transitionClassNames,
|
||||
} = useShowTransition(!orderedFolderIds, undefined, true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user