How to create multiple registration screens in react native
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
add a comment |
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
add a comment |
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
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
javascript reactjs firebase react-native firebase-realtime-database
edited Nov 13 at 3:47
asked Nov 12 at 20:19
Aidan Armstrong
208
208
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Can you provide the code for RootNav and MainNav please? Right now it’s hard to tell how you nested the navigators.
Hi thanks for answering, i have edited my question and added in the rootNav and mainNav files
– Aidan Armstrong
Nov 13 at 3:49
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Can you provide the code for RootNav and MainNav please? Right now it’s hard to tell how you nested the navigators.
Hi thanks for answering, i have edited my question and added in the rootNav and mainNav files
– Aidan Armstrong
Nov 13 at 3:49
add a comment |
Can you provide the code for RootNav and MainNav please? Right now it’s hard to tell how you nested the navigators.
Hi thanks for answering, i have edited my question and added in the rootNav and mainNav files
– Aidan Armstrong
Nov 13 at 3:49
add a comment |
Can you provide the code for RootNav and MainNav please? Right now it’s hard to tell how you nested the navigators.
Can you provide the code for RootNav and MainNav please? Right now it’s hard to tell how you nested the navigators.
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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