Fixed login redirection

This commit is contained in:
Arnaud Vergnet 2020-04-10 00:23:22 +02:00
parent 4f80cadfed
commit 9f74e64d70
2 changed files with 25 additions and 23 deletions

View file

@ -86,11 +86,13 @@ class ErrorView extends React.PureComponent<Props, State> {
</Button>; </Button>;
} }
goToLogin = () => this.props.navigation.navigate("login", goToLogin = () => {
console.log(this.props.route);
this.props.navigation.navigate("login",
{ {
screen: 'index', screen: 'login',
params: {nextScreen: this.props.route.name} params: {nextScreen: this.props.route.name}
}); })};
getLoginButton() { getLoginButton() {
return <Button return <Button

View file

@ -39,12 +39,12 @@ const AboutStack = createStackNavigator();
function AboutStackComponent() { function AboutStackComponent() {
return ( return (
<AboutStack.Navigator <AboutStack.Navigator
initialRouteName="index" initialRouteName="about"
headerMode="float" headerMode="float"
screenOptions={defaultScreenOptions} screenOptions={defaultScreenOptions}
> >
<AboutStack.Screen <AboutStack.Screen
name="index" name="about"
component={AboutScreen} component={AboutScreen}
options={({navigation}) => { options={({navigation}) => {
const openDrawer = getDrawerButton.bind(this, navigation); const openDrawer = getDrawerButton.bind(this, navigation);
@ -77,12 +77,12 @@ const SettingsStack = createStackNavigator();
function SettingsStackComponent() { function SettingsStackComponent() {
return ( return (
<SettingsStack.Navigator <SettingsStack.Navigator
initialRouteName="index" initialRouteName="settings"
headerMode="float" headerMode="float"
screenOptions={defaultScreenOptions} screenOptions={defaultScreenOptions}
> >
<SettingsStack.Screen <SettingsStack.Screen
name="index" name="settings"
component={SettingsScreen} component={SettingsScreen}
options={({navigation}) => { options={({navigation}) => {
const openDrawer = getDrawerButton.bind(this, navigation); const openDrawer = getDrawerButton.bind(this, navigation);
@ -101,12 +101,12 @@ const SelfMenuStack = createStackNavigator();
function SelfMenuStackComponent() { function SelfMenuStackComponent() {
return ( return (
<SelfMenuStack.Navigator <SelfMenuStack.Navigator
initialRouteName="index" initialRouteName="self-menu"
headerMode="float" headerMode="float"
screenOptions={defaultScreenOptions} screenOptions={defaultScreenOptions}
> >
<SelfMenuStack.Screen <SelfMenuStack.Screen
name="index" name="self-menu"
component={SelfMenuScreen} component={SelfMenuScreen}
options={({navigation}) => { options={({navigation}) => {
const openDrawer = getDrawerButton.bind(this, navigation); const openDrawer = getDrawerButton.bind(this, navigation);
@ -125,12 +125,12 @@ const AvailableRoomStack = createStackNavigator();
function AvailableRoomStackComponent() { function AvailableRoomStackComponent() {
return ( return (
<AvailableRoomStack.Navigator <AvailableRoomStack.Navigator
initialRouteName="index" initialRouteName="available-rooms"
headerMode="float" headerMode="float"
screenOptions={defaultScreenOptions} screenOptions={defaultScreenOptions}
> >
<AvailableRoomStack.Screen <AvailableRoomStack.Screen
name="index" name="available-rooms"
component={AvailableRoomScreen} component={AvailableRoomScreen}
options={({navigation}) => { options={({navigation}) => {
const openDrawer = getDrawerButton.bind(this, navigation); const openDrawer = getDrawerButton.bind(this, navigation);
@ -149,12 +149,12 @@ const BibStack = createStackNavigator();
function BibStackComponent() { function BibStackComponent() {
return ( return (
<BibStack.Navigator <BibStack.Navigator
initialRouteName="index" initialRouteName="bib"
headerMode="float" headerMode="float"
screenOptions={defaultScreenOptions} screenOptions={defaultScreenOptions}
> >
<BibStack.Screen <BibStack.Screen
name="index" name="bib"
component={BibScreen} component={BibScreen}
options={({navigation}) => { options={({navigation}) => {
const openDrawer = getDrawerButton.bind(this, navigation); const openDrawer = getDrawerButton.bind(this, navigation);
@ -173,12 +173,12 @@ const TetrisStack = createStackNavigator();
function TetrisStackComponent() { function TetrisStackComponent() {
return ( return (
<TetrisStack.Navigator <TetrisStack.Navigator
initialRouteName="index" initialRouteName="tetris"
headerMode="float" headerMode="float"
screenOptions={defaultScreenOptions} screenOptions={defaultScreenOptions}
> >
<TetrisStack.Screen <TetrisStack.Screen
name="index" name="tetris"
component={TetrisScreen} component={TetrisScreen}
options={({navigation}) => { options={({navigation}) => {
const openDrawer = getDrawerButton.bind(this, navigation); const openDrawer = getDrawerButton.bind(this, navigation);
@ -197,12 +197,12 @@ const LoginStack = createStackNavigator();
function LoginStackComponent() { function LoginStackComponent() {
return ( return (
<LoginStack.Navigator <LoginStack.Navigator
initialRouteName="index" initialRouteName="login"
headerMode="float" headerMode="float"
screenOptions={defaultScreenOptions} screenOptions={defaultScreenOptions}
> >
<LoginStack.Screen <LoginStack.Screen
name="index" name="login"
component={LoginScreen} component={LoginScreen}
options={({navigation}) => { options={({navigation}) => {
const openDrawer = getDrawerButton.bind(this, navigation); const openDrawer = getDrawerButton.bind(this, navigation);
@ -221,12 +221,12 @@ const ProfileStack = createStackNavigator();
function ProfileStackComponent() { function ProfileStackComponent() {
return ( return (
<ProfileStack.Navigator <ProfileStack.Navigator
initialRouteName="index" initialRouteName="profile"
headerMode="float" headerMode="float"
screenOptions={defaultScreenOptions} screenOptions={defaultScreenOptions}
> >
<ProfileStack.Screen <ProfileStack.Screen
name="index" name="profile"
component={ProfileScreen} component={ProfileScreen}
options={({navigation}) => { options={({navigation}) => {
const openDrawer = getDrawerButton.bind(this, navigation); const openDrawer = getDrawerButton.bind(this, navigation);
@ -256,12 +256,12 @@ const VoteStack = createStackNavigator();
function VoteStackComponent() { function VoteStackComponent() {
return ( return (
<VoteStack.Navigator <VoteStack.Navigator
initialRouteName="index" initialRouteName="vote"
headerMode="float" headerMode="float"
screenOptions={defaultScreenOptions} screenOptions={defaultScreenOptions}
> >
<VoteStack.Screen <VoteStack.Screen
name="index" name="vote"
component={VoteScreen} component={VoteScreen}
options={({navigation}) => { options={({navigation}) => {
const openDrawer = getDrawerButton.bind(this, navigation); const openDrawer = getDrawerButton.bind(this, navigation);
@ -280,12 +280,12 @@ const ClubStack = createStackNavigator();
function ClubStackComponent() { function ClubStackComponent() {
return ( return (
<ClubStack.Navigator <ClubStack.Navigator
initialRouteName={"index"} initialRouteName={"club-list"}
headerMode="float" headerMode="float"
screenOptions={defaultScreenOptions} screenOptions={defaultScreenOptions}
> >
<ClubStack.Screen <ClubStack.Screen
name="index" name="club-list"
component={ClubListScreen} component={ClubListScreen}
options={({navigation}) => { options={({navigation}) => {
const openDrawer = getDrawerButton.bind(this, navigation); const openDrawer = getDrawerButton.bind(this, navigation);