mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Special case goBack to navigate to catalog if no where to go back to (#4544)
This commit is contained in:
parent
6284bd1eb4
commit
747ef8daee
@ -26,6 +26,7 @@ import { observer } from "mobx-react";
|
||||
import { cssNames, IClassName } from "../../utils";
|
||||
import { navigation } from "../../navigation";
|
||||
import { Icon } from "../icon";
|
||||
import { catalogURL } from "../../../common/routes";
|
||||
|
||||
export interface SettingLayoutProps extends React.DOMAttributes<any> {
|
||||
className?: IClassName;
|
||||
@ -39,7 +40,13 @@ export interface SettingLayoutProps extends React.DOMAttributes<any> {
|
||||
const defaultProps: Partial<SettingLayoutProps> = {
|
||||
provideBackButtonNavigation: true,
|
||||
contentGaps: true,
|
||||
back: () => navigation.goBack(),
|
||||
back: () => {
|
||||
if (navigation.length <= 1) {
|
||||
navigation.push(catalogURL());
|
||||
} else {
|
||||
navigation.goBack();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user