mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-13 18:59:22 -05:00
fix(bottom nav): replace path instead of going back
This commit is contained in:
parent
05266790ae
commit
271a126a3f
2 changed files with 8 additions and 11 deletions
|
@ -67,13 +67,13 @@ export default observer(() => {
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (settingsActive) {
|
if (settingsActive) {
|
||||||
if (history.length > 0) {
|
if (history.length > 0) {
|
||||||
history.goBack();
|
history.replace(layout.getLastPath());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const path = layout.getLastHomePath();
|
const path = layout.getLastHomePath();
|
||||||
if (path === "/friends") {
|
if (path.startsWith("/friends")) {
|
||||||
history.push("/");
|
history.push("/");
|
||||||
} else {
|
} else {
|
||||||
history.push(path);
|
history.push(path);
|
||||||
|
|
|
@ -55,20 +55,17 @@ export function GenericSettings({
|
||||||
indexHeader,
|
indexHeader,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const theme = useApplicationState().settings.theme;
|
const state = useApplicationState();
|
||||||
|
const theme = state.settings.theme;
|
||||||
const { page } = useParams<{ page: string }>();
|
const { page } = useParams<{ page: string }>();
|
||||||
|
|
||||||
const [closing, setClosing] = useState(false);
|
const [closing, setClosing] = useState(false);
|
||||||
const exitSettings = useCallback(() => {
|
const exitSettings = useCallback(() => {
|
||||||
if (history.length > 1) {
|
setClosing(true);
|
||||||
setClosing(true);
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
history.goBack();
|
history.replace(state.layout.getLastPath());
|
||||||
}, 100);
|
}, 100);
|
||||||
} else {
|
|
||||||
history.push("/");
|
|
||||||
}
|
|
||||||
}, [history]);
|
}, [history]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
Loading…
Reference in a new issue