Skip to content

Commit

Permalink
Prevent going back when no servers are added
Browse files Browse the repository at this point in the history
  • Loading branch information
thornbill committed Jun 25, 2020
1 parent 209e48e commit 543e1cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions components/ServerInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ class ServerInput extends React.Component {
this.props.onSuccess();
}
// Navigate to the main screen
this.props.navigation.reset({
index: 0,
routes: [{
name: this.props.successScreen || 'Main',
props: { activeServer: servers.length - 1 }
}]
});
this.props.navigation.replace(
'Main',
{
screen: this.props.successScreen || 'Home',
params: { activeServer: servers.length - 1 }
}
);
} else {
this.setState({
isValid: false,
Expand Down
4 changes: 2 additions & 2 deletions screens/SettingsScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class SettingsScreen extends React.Component {
this.props.navigation.navigate('Home', { activeServer: 0 });
} else {
// No servers are present, navigate to add server screen
this.props.navigation.navigate('AddServer');
this.props.navigation.replace('AddServer');
}
}

Expand All @@ -186,7 +186,7 @@ class SettingsScreen extends React.Component {
// Reset the storage cache
CachingStorage.instance = null;
// Navigate to the loading screen
this.props.navigation.navigate('AddServer');
this.props.navigation.replace('AddServer');
}

onDeleteServer(index) {
Expand Down

0 comments on commit 543e1cd

Please sign in to comment.