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 buildClassName from '../../../util/buildClassName';
|
||||||
import useThrottledMemo from '../../../hooks/useThrottledMemo';
|
import useThrottledMemo from '../../../hooks/useThrottledMemo';
|
||||||
import useLang from '../../../hooks/useLang';
|
import useLang from '../../../hooks/useLang';
|
||||||
|
import captureEscKeyListener from '../../../util/captureEscKeyListener';
|
||||||
|
|
||||||
import Transition from '../../ui/Transition';
|
import Transition from '../../ui/Transition';
|
||||||
import TabList from '../../ui/TabList';
|
import TabList from '../../ui/TabList';
|
||||||
@ -122,6 +123,14 @@ const ChatFolders: FC<StateProps & DispatchProps> = ({
|
|||||||
});
|
});
|
||||||
}, [activeTab, folderTabs]);
|
}, [activeTab, folderTabs]);
|
||||||
|
|
||||||
|
const isNotInAllTabRef = useRef();
|
||||||
|
isNotInAllTabRef.current = activeTab !== 0;
|
||||||
|
useEffect(() => captureEscKeyListener(() => {
|
||||||
|
if (isNotInAllTabRef.current) {
|
||||||
|
setActiveTab(0);
|
||||||
|
}
|
||||||
|
}), []);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
shouldRender: shouldRenderPlaceholder, transitionClassNames,
|
shouldRender: shouldRenderPlaceholder, transitionClassNames,
|
||||||
} = useShowTransition(!orderedFolderIds, undefined, true);
|
} = useShowTransition(!orderedFolderIds, undefined, true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user