How to create multiple registration screens in react native










0














I have a RootNav and a MainNav, in my RootNav i have a login and signup screen. When a user Signs up via firebase with email and password it automatically logs them in so it goes to MainNav. i want to be able to send them to a few screens after they have signed up via firebase like NameScreen and Age Screen so the user inputs their name so i can add this to the firebase database.



I am using stackNavigator.



App.js



import React from 'react';
import Stylesheet, View, Text from 'react-native';
import AppLoading, Asset from 'expo';
import * as firebase from 'firebase';

import RootNav from './navigation/RootNav';
import MainNav from './navigation/MainNav';

// SplashScreen
import SplashScreen from './screens/SplashScreen'

const firebaseConfig =
apiKey: "ProjectKey",
authDomain: "projectDomain.com",
databaseURL: "https://URl.com",
pojectID: "pojectID",



export default class App extends React.Component
constructor(props)
super(props);
this.state =
isLoadingComplete: false,
isAuthenticatingReady: false,
isAuthenticated: false,
;

SplashScreen.load(v => this.setState(isLoadingComplete: true));
if (!firebase.apps.length)
firebase.initializeApp(firebaseConfig);

firebase.auth().onAuthStateChanged(this.onAuthStateChanged);



onAuthStateChanged = (user) =>
this.setState(isAuthenticatingReady: true);
this.setState(isAuthenticated: !!user);


render()
return (
<View style=flex: 1,>


(this.state.isLoadingComplete) ? (this.state.isAuthenticated) ?
<MainNav /> : <RootNav /> : <SplashScreen />


</View>
)




MainNav.js



import React from 'react';
import createStackNavigator, from 'react-navigation';
import MainScreen from './../screens/MainScreen';
import Check from './../navigation/Check';

const MainNav = createStackNavigator(

Check: screen: Check,
Home: screen: MainScreen ,

,

navigationOptions: () => (
header: null,
)

);

export default MainNav;


RootNav.js



import React from 'react';
import createStackNavigator, from 'react-navigation';
import LoginScreen from './../screens/auth/LoginScreen';
import SignUpScreen from './../screens/auth/SignUpScreen';
import addNameScreen from '../screens/auth/addNameScreen';
import addAgeScreen from '../screens/auth/addAgeScreen';

const RootNav = createStackNavigator(

Login: screen: LoginScreen ,
SignUp: screen: SignUpScreen ,
addName: screen: addNameScreen,
addAge: screen: addAgeScreen,
,

navigationOptions: () => (
header: null,
)

);

export default RootNav;


How would i be able to do this? any indication would help me please thank you.










share|improve this question




























    0














    I have a RootNav and a MainNav, in my RootNav i have a login and signup screen. When a user Signs up via firebase with email and password it automatically logs them in so it goes to MainNav. i want to be able to send them to a few screens after they have signed up via firebase like NameScreen and Age Screen so the user inputs their name so i can add this to the firebase database.



    I am using stackNavigator.



    App.js



    import React from 'react';
    import Stylesheet, View, Text from 'react-native';
    import AppLoading, Asset from 'expo';
    import * as firebase from 'firebase';

    import RootNav from './navigation/RootNav';
    import MainNav from './navigation/MainNav';

    // SplashScreen
    import SplashScreen from './screens/SplashScreen'

    const firebaseConfig =
    apiKey: "ProjectKey",
    authDomain: "projectDomain.com",
    databaseURL: "https://URl.com",
    pojectID: "pojectID",



    export default class App extends React.Component
    constructor(props)
    super(props);
    this.state =
    isLoadingComplete: false,
    isAuthenticatingReady: false,
    isAuthenticated: false,
    ;

    SplashScreen.load(v => this.setState(isLoadingComplete: true));
    if (!firebase.apps.length)
    firebase.initializeApp(firebaseConfig);

    firebase.auth().onAuthStateChanged(this.onAuthStateChanged);



    onAuthStateChanged = (user) =>
    this.setState(isAuthenticatingReady: true);
    this.setState(isAuthenticated: !!user);


    render()
    return (
    <View style=flex: 1,>


    (this.state.isLoadingComplete) ? (this.state.isAuthenticated) ?
    <MainNav /> : <RootNav /> : <SplashScreen />


    </View>
    )




    MainNav.js



    import React from 'react';
    import createStackNavigator, from 'react-navigation';
    import MainScreen from './../screens/MainScreen';
    import Check from './../navigation/Check';

    const MainNav = createStackNavigator(

    Check: screen: Check,
    Home: screen: MainScreen ,

    ,

    navigationOptions: () => (
    header: null,
    )

    );

    export default MainNav;


    RootNav.js



    import React from 'react';
    import createStackNavigator, from 'react-navigation';
    import LoginScreen from './../screens/auth/LoginScreen';
    import SignUpScreen from './../screens/auth/SignUpScreen';
    import addNameScreen from '../screens/auth/addNameScreen';
    import addAgeScreen from '../screens/auth/addAgeScreen';

    const RootNav = createStackNavigator(

    Login: screen: LoginScreen ,
    SignUp: screen: SignUpScreen ,
    addName: screen: addNameScreen,
    addAge: screen: addAgeScreen,
    ,

    navigationOptions: () => (
    header: null,
    )

    );

    export default RootNav;


    How would i be able to do this? any indication would help me please thank you.










    share|improve this question


























      0












      0








      0







      I have a RootNav and a MainNav, in my RootNav i have a login and signup screen. When a user Signs up via firebase with email and password it automatically logs them in so it goes to MainNav. i want to be able to send them to a few screens after they have signed up via firebase like NameScreen and Age Screen so the user inputs their name so i can add this to the firebase database.



      I am using stackNavigator.



      App.js



      import React from 'react';
      import Stylesheet, View, Text from 'react-native';
      import AppLoading, Asset from 'expo';
      import * as firebase from 'firebase';

      import RootNav from './navigation/RootNav';
      import MainNav from './navigation/MainNav';

      // SplashScreen
      import SplashScreen from './screens/SplashScreen'

      const firebaseConfig =
      apiKey: "ProjectKey",
      authDomain: "projectDomain.com",
      databaseURL: "https://URl.com",
      pojectID: "pojectID",



      export default class App extends React.Component
      constructor(props)
      super(props);
      this.state =
      isLoadingComplete: false,
      isAuthenticatingReady: false,
      isAuthenticated: false,
      ;

      SplashScreen.load(v => this.setState(isLoadingComplete: true));
      if (!firebase.apps.length)
      firebase.initializeApp(firebaseConfig);

      firebase.auth().onAuthStateChanged(this.onAuthStateChanged);



      onAuthStateChanged = (user) =>
      this.setState(isAuthenticatingReady: true);
      this.setState(isAuthenticated: !!user);


      render()
      return (
      <View style=flex: 1,>


      (this.state.isLoadingComplete) ? (this.state.isAuthenticated) ?
      <MainNav /> : <RootNav /> : <SplashScreen />


      </View>
      )




      MainNav.js



      import React from 'react';
      import createStackNavigator, from 'react-navigation';
      import MainScreen from './../screens/MainScreen';
      import Check from './../navigation/Check';

      const MainNav = createStackNavigator(

      Check: screen: Check,
      Home: screen: MainScreen ,

      ,

      navigationOptions: () => (
      header: null,
      )

      );

      export default MainNav;


      RootNav.js



      import React from 'react';
      import createStackNavigator, from 'react-navigation';
      import LoginScreen from './../screens/auth/LoginScreen';
      import SignUpScreen from './../screens/auth/SignUpScreen';
      import addNameScreen from '../screens/auth/addNameScreen';
      import addAgeScreen from '../screens/auth/addAgeScreen';

      const RootNav = createStackNavigator(

      Login: screen: LoginScreen ,
      SignUp: screen: SignUpScreen ,
      addName: screen: addNameScreen,
      addAge: screen: addAgeScreen,
      ,

      navigationOptions: () => (
      header: null,
      )

      );

      export default RootNav;


      How would i be able to do this? any indication would help me please thank you.










      share|improve this question















      I have a RootNav and a MainNav, in my RootNav i have a login and signup screen. When a user Signs up via firebase with email and password it automatically logs them in so it goes to MainNav. i want to be able to send them to a few screens after they have signed up via firebase like NameScreen and Age Screen so the user inputs their name so i can add this to the firebase database.



      I am using stackNavigator.



      App.js



      import React from 'react';
      import Stylesheet, View, Text from 'react-native';
      import AppLoading, Asset from 'expo';
      import * as firebase from 'firebase';

      import RootNav from './navigation/RootNav';
      import MainNav from './navigation/MainNav';

      // SplashScreen
      import SplashScreen from './screens/SplashScreen'

      const firebaseConfig =
      apiKey: "ProjectKey",
      authDomain: "projectDomain.com",
      databaseURL: "https://URl.com",
      pojectID: "pojectID",



      export default class App extends React.Component
      constructor(props)
      super(props);
      this.state =
      isLoadingComplete: false,
      isAuthenticatingReady: false,
      isAuthenticated: false,
      ;

      SplashScreen.load(v => this.setState(isLoadingComplete: true));
      if (!firebase.apps.length)
      firebase.initializeApp(firebaseConfig);

      firebase.auth().onAuthStateChanged(this.onAuthStateChanged);



      onAuthStateChanged = (user) =>
      this.setState(isAuthenticatingReady: true);
      this.setState(isAuthenticated: !!user);


      render()
      return (
      <View style=flex: 1,>


      (this.state.isLoadingComplete) ? (this.state.isAuthenticated) ?
      <MainNav /> : <RootNav /> : <SplashScreen />


      </View>
      )




      MainNav.js



      import React from 'react';
      import createStackNavigator, from 'react-navigation';
      import MainScreen from './../screens/MainScreen';
      import Check from './../navigation/Check';

      const MainNav = createStackNavigator(

      Check: screen: Check,
      Home: screen: MainScreen ,

      ,

      navigationOptions: () => (
      header: null,
      )

      );

      export default MainNav;


      RootNav.js



      import React from 'react';
      import createStackNavigator, from 'react-navigation';
      import LoginScreen from './../screens/auth/LoginScreen';
      import SignUpScreen from './../screens/auth/SignUpScreen';
      import addNameScreen from '../screens/auth/addNameScreen';
      import addAgeScreen from '../screens/auth/addAgeScreen';

      const RootNav = createStackNavigator(

      Login: screen: LoginScreen ,
      SignUp: screen: SignUpScreen ,
      addName: screen: addNameScreen,
      addAge: screen: addAgeScreen,
      ,

      navigationOptions: () => (
      header: null,
      )

      );

      export default RootNav;


      How would i be able to do this? any indication would help me please thank you.







      javascript reactjs firebase react-native firebase-realtime-database






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 13 at 3:47

























      asked Nov 12 at 20:19









      Aidan Armstrong

      208




      208






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Can you provide the code for RootNav and MainNav please? Right now it’s hard to tell how you nested the navigators.






          share|improve this answer




















          • Hi thanks for answering, i have edited my question and added in the rootNav and mainNav files
            – Aidan Armstrong
            Nov 13 at 3:49










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269491%2fhow-to-create-multiple-registration-screens-in-react-native%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Can you provide the code for RootNav and MainNav please? Right now it’s hard to tell how you nested the navigators.






          share|improve this answer




















          • Hi thanks for answering, i have edited my question and added in the rootNav and mainNav files
            – Aidan Armstrong
            Nov 13 at 3:49















          0














          Can you provide the code for RootNav and MainNav please? Right now it’s hard to tell how you nested the navigators.






          share|improve this answer




















          • Hi thanks for answering, i have edited my question and added in the rootNav and mainNav files
            – Aidan Armstrong
            Nov 13 at 3:49













          0












          0








          0






          Can you provide the code for RootNav and MainNav please? Right now it’s hard to tell how you nested the navigators.






          share|improve this answer












          Can you provide the code for RootNav and MainNav please? Right now it’s hard to tell how you nested the navigators.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 12 at 21:25









          Juust

          407




          407











          • Hi thanks for answering, i have edited my question and added in the rootNav and mainNav files
            – Aidan Armstrong
            Nov 13 at 3:49
















          • Hi thanks for answering, i have edited my question and added in the rootNav and mainNav files
            – Aidan Armstrong
            Nov 13 at 3:49















          Hi thanks for answering, i have edited my question and added in the rootNav and mainNav files
          – Aidan Armstrong
          Nov 13 at 3:49




          Hi thanks for answering, i have edited my question and added in the rootNav and mainNav files
          – Aidan Armstrong
          Nov 13 at 3:49

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269491%2fhow-to-create-multiple-registration-screens-in-react-native%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Top Tejano songwriter Luis Silva dead of heart attack at 64

          ReactJS Fetched API data displays live - need Data displayed static

          Evgeni Malkin