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) => {
|
||||
if (event.data.state.routes !== undefined) {
|
||||
const route = event.data.state.routes[0]; // get the current route (ROOT)
|
||||
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.
|
||||
// Tab routes will be shown as 'Main'
|
||||
const routeName = state.routeNames[state.index];
|
||||
if (this.state.activeRoute !== routeName)
|
||||
this.setState({activeRoute: routeName});
|
||||
}
|
||||
|
||||
try {
|
||||
const state = event.data.state.routes[0].state; // Get the Drawer's state if it exists
|
||||
// Get the current route name. This will only show Drawer routes.
|
||||
// Tab routes will be shown as 'Main'
|
||||
const routeName = state.routeNames[state.index];
|
||||
if (this.state.activeRoute !== routeName)
|
||||
this.setState({activeRoute: routeName});
|
||||
} catch(e) {
|
||||
this.setState({activeRoute: 'Main'});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
showDisconnectDialog = () => this.setState({dialogVisible: true});
|
||||
|
|
Loading…
Reference in a new issue