diff --git a/react/src/components/createControllerComponent.tsx b/react/src/components/createControllerComponent.tsx index f467b071e10..84d0fba35d4 100644 --- a/react/src/components/createControllerComponent.tsx +++ b/react/src/components/createControllerComponent.tsx @@ -7,11 +7,11 @@ export function createControllerComponent) => void; } - type Props = T & ReactProps; + type Props = T & ReactControllerProps; return class ReactControllerComponent extends React.Component { element: E; diff --git a/react/src/components/createOverlayComponent.tsx b/react/src/components/createOverlayComponent.tsx index 09c11d81c89..d5b3a6c2e0a 100644 --- a/react/src/components/createOverlayComponent.tsx +++ b/react/src/components/createOverlayComponent.tsx @@ -9,14 +9,14 @@ export function createOverlayComponent) => void; } - type Props = T & ReactProps; + type Props = T & ReactOverlayProps; - return class ReactControllerComponent extends React.Component { + return class ReactOverlayComponent extends React.Component { element: E; controllerElement: C; el: HTMLDivElement; diff --git a/react/src/components/navigation/IonRouterOutlet.tsx b/react/src/components/navigation/IonRouterOutlet.tsx index c51823b7c4e..429db87ac8f 100644 --- a/react/src/components/navigation/IonRouterOutlet.tsx +++ b/react/src/components/navigation/IonRouterOutlet.tsx @@ -32,7 +32,7 @@ interface State { } interface ContextInterface { - goBack: () => void + goBack: (defaultHref?: string) => void } const Context = React.createContext({ @@ -152,11 +152,11 @@ class RouterOutlet extends Component { }); } - goBack = () => { + goBack = (defaultHref?: string) => { const prevView = this.state.views.find(v => v.id === this.state.activeId); const newView = this.state.views.find(v => v.id === prevView.prevId); - - this.props.history.replace(newView.location.pathname); + const newPath = newView ? newView.location.pathname : defaultHref; + this.props.history.replace(newPath); } componentDidUpdate() { @@ -232,8 +232,7 @@ export class IonBackButton extends Component { clickButton = (e: MouseEvent) => { e.stopPropagation(); - - this.context.goBack(); + this.context.goBack(this.props.defaultHref); } render() {