Fixed crash on navigation reset
This commit is contained in:
parent
4c746a0b60
commit
7295108832
1 changed files with 10 additions and 11 deletions
|
@ -161,18 +161,17 @@ class SideBar extends React.Component<Props, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
onRouteChange = (event) => {
|
onRouteChange = (event) => {
|
||||||
if (event.data.state.routes !== undefined) {
|
try {
|
||||||
const route = event.data.state.routes[0]; // get the current route (ROOT)
|
const state = event.data.state.routes[0].state; // Get the Drawer's state if it exists
|
||||||
if (route.state !== undefined) {
|
|
||||||
const state = route.state; // Get the Drawer's state if it exists
|
|
||||||
// Get the current route name. This will only show Drawer routes.
|
// Get the current route name. This will only show Drawer routes.
|
||||||
// Tab routes will be shown as 'Main'
|
// Tab routes will be shown as 'Main'
|
||||||
const routeName = state.routeNames[state.index];
|
const routeName = state.routeNames[state.index];
|
||||||
if (this.state.activeRoute !== routeName)
|
if (this.state.activeRoute !== routeName)
|
||||||
this.setState({activeRoute: routeName});
|
this.setState({activeRoute: routeName});
|
||||||
|
} catch(e) {
|
||||||
|
this.setState({activeRoute: 'Main'});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
showDisconnectDialog = () => this.setState({dialogVisible: true});
|
showDisconnectDialog = () => this.setState({dialogVisible: true});
|
||||||
|
|
Loading…
Reference in a new issue