React native this.props.navigation.navigate undefinedDisabling buttons on react nativeShow splash screen before show main screen in react native without using 3rd party libraryReact Native: TypeError: undefined is not an object (evaluating 'this.props.navigation.navigate')React Native - Touches not working after initializing app with splash screen and navigation.setRoot()How to push a new scene using react-navigation?how to navigate to homescreen onPress of login button in react native?I am using React-native and node js.I am not able to navigate from one screen to another after getting response from Node jsReact Native Navigation invoke all screens componentDidMount/componentWillMount when navigated to Home after loginGetting error for navigation in segment - react-nativeReact native navigation (undefined is not an object .. this.props.navigation.navigate

declaring a variable twice in IIFE

If Manufacturer spice model and Datasheet give different values which should I use?

Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?

Chess with symmetric move-square

N.B. ligature in Latex

Why was the small council so happy for Tyrion to become the Master of Coin?

Is it possible to do 50 km distance without any previous training?

What is the meaning of "of trouble" in the following sentence?

How to make payment on the internet without leaving a money trail?

Is there a minimum number of transactions in a block?

Could a US political party gain complete control over the government by removing checks & balances?

What do you call a Matrix-like slowdown and camera movement effect?

Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)

Download, install and reboot computer at night if needed

Example of a relative pronoun

How is it possible for user's password to be changed after storage was encrypted? (on OS X, Android)

What is the command to reset a PC without deleting any files

Circuitry of TV splitters

Simulate Bitwise Cyclic Tag

Motorized valve interfering with button?

Why is the design of haulage companies so “special”?

Can a German sentence have two subjects?

How to calculate implied correlation via observed market price (Margrabe option)

Can an x86 CPU running in real mode be considered to be basically an 8086 CPU?



React native this.props.navigation.navigate undefined


Disabling buttons on react nativeShow splash screen before show main screen in react native without using 3rd party libraryReact Native: TypeError: undefined is not an object (evaluating 'this.props.navigation.navigate')React Native - Touches not working after initializing app with splash screen and navigation.setRoot()How to push a new scene using react-navigation?how to navigate to homescreen onPress of login button in react native?I am using React-native and node js.I am not able to navigate from one screen to another after getting response from Node jsReact Native Navigation invoke all screens componentDidMount/componentWillMount when navigated to Home after loginGetting error for navigation in segment - react-nativeReact native navigation (undefined is not an object .. this.props.navigation.navigate






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















navigation.js



 import React, Component from 'react'
import createStackNavigator,createAppContainer from 'react-navigation'
import Login from './screens/login'
import SplashScreen from './screens/splashScreen'

// export const Nav = createStackNavigator(
// splashScreen: screen: SplashScreen ,
// loginScreen: screen:Login ,
// , initialRouteName: 'splashScreen' )

// export default createAppContainer(Nav);

const Nav = createStackNavigator(
loginScreen: screen: Login ,
splashScreen: screen: SplashScreen,

initialRouteName: 'splashScreen',

)
export default createAppContainer(Nav);


splashscreen.js



 import React, Component from "react";
import Image, StyleSheet, Text, TouchableOpacity, View from "react-native";
import appContainer from '../styleSheet'
import Nav from '../navigations'
import createStackNavigator,createAppContainer from 'react-navigation'

class SplashScreen extends Component

componentWillMount()
setTimeout(() =>
// alert('I will redirect')
this.props.navigation.navigate("loginScreen");
, 3000);


render()
return (
<View style=appContainer.AppContainer>
<Text style=appContainer.splashSC> Who Around Me </Text>
</View>
)



export default SplashScreen


login.js



import React, Component from "react";
import Image, StyleSheet, Text, TouchableOpacity, View from "react-native";
import appContainer,buttons from '../styleSheet'

class Login extends Component
render()
return (
<View style=appContainer.AppContainer>

<Text style=buttons.loginBtnText>
Login with Sim
</Text>
</View>
)


export default Login


App.js



 /**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
* @lint-ignore-every XPLATJSCOPYRIGHT1
*/

import React, Component from 'react';
import Platform, StyleSheet, Text, View from 'react-native';
import SplashScreen from './screens/splashScreen'
import createStackNavigator,createAppContainer from 'react-navigation'
import Login from './screens/login'
import Nav from './navigations'

const App = () => (
<Nav />
);

export default App;


index.android.js



import React, Component from "react";
import AppRegistry from "react-native";
import createStackNavigator,createAppContainer from 'react-navigation'
import App from "./src/App";

AppRegistry.registerComponent("WhoAroundMe", () => App);


this.props.navigation.navigate("loginScreen"); throws error




this.props.navigation.navigate undefined




Could not able to resolve by doing alot google.



Any help appreciated.
Thanks










share|improve this question






























    0















    navigation.js



     import React, Component from 'react'
    import createStackNavigator,createAppContainer from 'react-navigation'
    import Login from './screens/login'
    import SplashScreen from './screens/splashScreen'

    // export const Nav = createStackNavigator(
    // splashScreen: screen: SplashScreen ,
    // loginScreen: screen:Login ,
    // , initialRouteName: 'splashScreen' )

    // export default createAppContainer(Nav);

    const Nav = createStackNavigator(
    loginScreen: screen: Login ,
    splashScreen: screen: SplashScreen,

    initialRouteName: 'splashScreen',

    )
    export default createAppContainer(Nav);


    splashscreen.js



     import React, Component from "react";
    import Image, StyleSheet, Text, TouchableOpacity, View from "react-native";
    import appContainer from '../styleSheet'
    import Nav from '../navigations'
    import createStackNavigator,createAppContainer from 'react-navigation'

    class SplashScreen extends Component

    componentWillMount()
    setTimeout(() =>
    // alert('I will redirect')
    this.props.navigation.navigate("loginScreen");
    , 3000);


    render()
    return (
    <View style=appContainer.AppContainer>
    <Text style=appContainer.splashSC> Who Around Me </Text>
    </View>
    )



    export default SplashScreen


    login.js



    import React, Component from "react";
    import Image, StyleSheet, Text, TouchableOpacity, View from "react-native";
    import appContainer,buttons from '../styleSheet'

    class Login extends Component
    render()
    return (
    <View style=appContainer.AppContainer>

    <Text style=buttons.loginBtnText>
    Login with Sim
    </Text>
    </View>
    )


    export default Login


    App.js



     /**
    * Sample React Native App
    * https://github.com/facebook/react-native
    *
    * @format
    * @flow
    * @lint-ignore-every XPLATJSCOPYRIGHT1
    */

    import React, Component from 'react';
    import Platform, StyleSheet, Text, View from 'react-native';
    import SplashScreen from './screens/splashScreen'
    import createStackNavigator,createAppContainer from 'react-navigation'
    import Login from './screens/login'
    import Nav from './navigations'

    const App = () => (
    <Nav />
    );

    export default App;


    index.android.js



    import React, Component from "react";
    import AppRegistry from "react-native";
    import createStackNavigator,createAppContainer from 'react-navigation'
    import App from "./src/App";

    AppRegistry.registerComponent("WhoAroundMe", () => App);


    this.props.navigation.navigate("loginScreen"); throws error




    this.props.navigation.navigate undefined




    Could not able to resolve by doing alot google.



    Any help appreciated.
    Thanks










    share|improve this question


























      0












      0








      0








      navigation.js



       import React, Component from 'react'
      import createStackNavigator,createAppContainer from 'react-navigation'
      import Login from './screens/login'
      import SplashScreen from './screens/splashScreen'

      // export const Nav = createStackNavigator(
      // splashScreen: screen: SplashScreen ,
      // loginScreen: screen:Login ,
      // , initialRouteName: 'splashScreen' )

      // export default createAppContainer(Nav);

      const Nav = createStackNavigator(
      loginScreen: screen: Login ,
      splashScreen: screen: SplashScreen,

      initialRouteName: 'splashScreen',

      )
      export default createAppContainer(Nav);


      splashscreen.js



       import React, Component from "react";
      import Image, StyleSheet, Text, TouchableOpacity, View from "react-native";
      import appContainer from '../styleSheet'
      import Nav from '../navigations'
      import createStackNavigator,createAppContainer from 'react-navigation'

      class SplashScreen extends Component

      componentWillMount()
      setTimeout(() =>
      // alert('I will redirect')
      this.props.navigation.navigate("loginScreen");
      , 3000);


      render()
      return (
      <View style=appContainer.AppContainer>
      <Text style=appContainer.splashSC> Who Around Me </Text>
      </View>
      )



      export default SplashScreen


      login.js



      import React, Component from "react";
      import Image, StyleSheet, Text, TouchableOpacity, View from "react-native";
      import appContainer,buttons from '../styleSheet'

      class Login extends Component
      render()
      return (
      <View style=appContainer.AppContainer>

      <Text style=buttons.loginBtnText>
      Login with Sim
      </Text>
      </View>
      )


      export default Login


      App.js



       /**
      * Sample React Native App
      * https://github.com/facebook/react-native
      *
      * @format
      * @flow
      * @lint-ignore-every XPLATJSCOPYRIGHT1
      */

      import React, Component from 'react';
      import Platform, StyleSheet, Text, View from 'react-native';
      import SplashScreen from './screens/splashScreen'
      import createStackNavigator,createAppContainer from 'react-navigation'
      import Login from './screens/login'
      import Nav from './navigations'

      const App = () => (
      <Nav />
      );

      export default App;


      index.android.js



      import React, Component from "react";
      import AppRegistry from "react-native";
      import createStackNavigator,createAppContainer from 'react-navigation'
      import App from "./src/App";

      AppRegistry.registerComponent("WhoAroundMe", () => App);


      this.props.navigation.navigate("loginScreen"); throws error




      this.props.navigation.navigate undefined




      Could not able to resolve by doing alot google.



      Any help appreciated.
      Thanks










      share|improve this question
















      navigation.js



       import React, Component from 'react'
      import createStackNavigator,createAppContainer from 'react-navigation'
      import Login from './screens/login'
      import SplashScreen from './screens/splashScreen'

      // export const Nav = createStackNavigator(
      // splashScreen: screen: SplashScreen ,
      // loginScreen: screen:Login ,
      // , initialRouteName: 'splashScreen' )

      // export default createAppContainer(Nav);

      const Nav = createStackNavigator(
      loginScreen: screen: Login ,
      splashScreen: screen: SplashScreen,

      initialRouteName: 'splashScreen',

      )
      export default createAppContainer(Nav);


      splashscreen.js



       import React, Component from "react";
      import Image, StyleSheet, Text, TouchableOpacity, View from "react-native";
      import appContainer from '../styleSheet'
      import Nav from '../navigations'
      import createStackNavigator,createAppContainer from 'react-navigation'

      class SplashScreen extends Component

      componentWillMount()
      setTimeout(() =>
      // alert('I will redirect')
      this.props.navigation.navigate("loginScreen");
      , 3000);


      render()
      return (
      <View style=appContainer.AppContainer>
      <Text style=appContainer.splashSC> Who Around Me </Text>
      </View>
      )



      export default SplashScreen


      login.js



      import React, Component from "react";
      import Image, StyleSheet, Text, TouchableOpacity, View from "react-native";
      import appContainer,buttons from '../styleSheet'

      class Login extends Component
      render()
      return (
      <View style=appContainer.AppContainer>

      <Text style=buttons.loginBtnText>
      Login with Sim
      </Text>
      </View>
      )


      export default Login


      App.js



       /**
      * Sample React Native App
      * https://github.com/facebook/react-native
      *
      * @format
      * @flow
      * @lint-ignore-every XPLATJSCOPYRIGHT1
      */

      import React, Component from 'react';
      import Platform, StyleSheet, Text, View from 'react-native';
      import SplashScreen from './screens/splashScreen'
      import createStackNavigator,createAppContainer from 'react-navigation'
      import Login from './screens/login'
      import Nav from './navigations'

      const App = () => (
      <Nav />
      );

      export default App;


      index.android.js



      import React, Component from "react";
      import AppRegistry from "react-native";
      import createStackNavigator,createAppContainer from 'react-navigation'
      import App from "./src/App";

      AppRegistry.registerComponent("WhoAroundMe", () => App);


      this.props.navigation.navigate("loginScreen"); throws error




      this.props.navigation.navigate undefined




      Could not able to resolve by doing alot google.



      Any help appreciated.
      Thanks







      android react-native react-navigation react-navigation-stack






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 8 at 10:14







      Md. Parvez Alam

















      asked Mar 8 at 6:00









      Md. Parvez AlamMd. Parvez Alam

      1,85121338




      1,85121338






















          5 Answers
          5






          active

          oldest

          votes


















          3














          I can't clearly understand the problem well, but you can try adding SplashScreen in createStackNavigator() in navigation.js file



          const StackNavigator = createStackNavigator(
          loginScreen: screen: Login ,
          splashScreen: screen: SplashScreen,

          initialRouteName: 'splashScreen',

          )
          export default createAppContainer(StackNavigator);


          In your App.js file replace with this:



          const App = () => (
          <Nav /> //instead of SplashScreen
          );





          share|improve this answer

























          • did that worked for you @Md. Parvez Alam?

            – Piyush Govil
            Mar 8 at 7:36











          • it says splashScreen must be react component

            – Md. Parvez Alam
            Mar 8 at 8:11











          • did you import SplashScreen in navigation.js ?

            – Piyush Govil
            Mar 8 at 8:16











          • Yes I did the same

            – Md. Parvez Alam
            Mar 8 at 8:17











          • But when I give initialRouteName it returns 500 error

            – Md. Parvez Alam
            Mar 8 at 8:18


















          2














          It is because your SplashScreen Component is not declared as a route in react-navigation. when you create route, you can put SplashScreen as route and set it as initial route name.






          export const Nav = createStackNavigator(

          splashScreen:
          screen: SplashScreen
          ,
          loginScreen:
          screen:Login

          ,

          initialRouteName: 'splashScreen'

          )








          share|improve this answer























          • it says splashScreen must be react component

            – Md. Parvez Alam
            Mar 8 at 8:11


















          2














          Pass the ...props when calling SplashScreen component



          import React, Component from 'react';
          import Platform, StyleSheet, Text, View from 'react-native';
          import SplashScreen from './screens/splashScreen'
          import createStackNavigator,createAppContainer from 'react-navigation'
          import Login from './screens/login'
          import Nav from './navigations'

          const App = () => (
          <SplashScreen ...props />
          );

          export default App;





          share|improve this answer























          • Not working, remove intialRoutename says says splashScreen must be react component, else if add initialRouteName says syntax error near initialRouteName

            – Md. Parvez Alam
            Mar 8 at 9:44


















          1














          Try to implement this



          App.js



          import React, Component from "react";
          import Platform, StyleSheet, Text, View from "react-native";
          import SplashScreen from "./splashScreen";
          import createStackNavigator, createAppContainer from "react-navigation";
          import Nav from "./navigations";<----changes-----

          export default class App extends Component
          render()
          return (
          <Nav />
          );




          Nav.js



          import React, Component from "react";
          import createStackNavigator, createAppContainer from "react-navigation";
          import Login from "./login";
          import SplashScreen from "./splashScreen";

          //<------replace your code from here
          const Nav = createStackNavigator(

          loginScreen: screen: Login ,
          splashScreen: screen: SplashScreen
          ,

          initialRouteName: "splashScreen"

          );
          export default createAppContainer(Nav);





          share|improve this answer

























          • remove intialRoutename says says splashScreen must be react component, else if add initialRouteName says syntax error near initialRouteName

            – Md. Parvez Alam
            Mar 8 at 9:53











          • have you add splashScreen: screen: SplashScreen, in your export const Nav = createStackNavigator( loginScreen: screen:Login ) navigation.js file ?

            – Paras Korat
            Mar 8 at 9:55












          • I have updated full source code

            – Md. Parvez Alam
            Mar 8 at 9:59











          • @Md.ParvezAlam i have updated my answer

            – Paras Korat
            Mar 8 at 10:08











          • Yes changing to Nav has been done after answer given by @piyush

            – Md. Parvez Alam
            Mar 8 at 10:12


















          1














          The main issue was I was importing navigations.js in screen files.



          Thanks all for your valuable comments I learned lots of things from you brothers






          share|improve this answer























          • Happy to help :)

            – Piyush Govil
            Mar 8 at 11:00











          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%2f55057548%2freact-native-this-props-navigation-navigate-undefined%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          5 Answers
          5






          active

          oldest

          votes








          5 Answers
          5






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          I can't clearly understand the problem well, but you can try adding SplashScreen in createStackNavigator() in navigation.js file



          const StackNavigator = createStackNavigator(
          loginScreen: screen: Login ,
          splashScreen: screen: SplashScreen,

          initialRouteName: 'splashScreen',

          )
          export default createAppContainer(StackNavigator);


          In your App.js file replace with this:



          const App = () => (
          <Nav /> //instead of SplashScreen
          );





          share|improve this answer

























          • did that worked for you @Md. Parvez Alam?

            – Piyush Govil
            Mar 8 at 7:36











          • it says splashScreen must be react component

            – Md. Parvez Alam
            Mar 8 at 8:11











          • did you import SplashScreen in navigation.js ?

            – Piyush Govil
            Mar 8 at 8:16











          • Yes I did the same

            – Md. Parvez Alam
            Mar 8 at 8:17











          • But when I give initialRouteName it returns 500 error

            – Md. Parvez Alam
            Mar 8 at 8:18















          3














          I can't clearly understand the problem well, but you can try adding SplashScreen in createStackNavigator() in navigation.js file



          const StackNavigator = createStackNavigator(
          loginScreen: screen: Login ,
          splashScreen: screen: SplashScreen,

          initialRouteName: 'splashScreen',

          )
          export default createAppContainer(StackNavigator);


          In your App.js file replace with this:



          const App = () => (
          <Nav /> //instead of SplashScreen
          );





          share|improve this answer

























          • did that worked for you @Md. Parvez Alam?

            – Piyush Govil
            Mar 8 at 7:36











          • it says splashScreen must be react component

            – Md. Parvez Alam
            Mar 8 at 8:11











          • did you import SplashScreen in navigation.js ?

            – Piyush Govil
            Mar 8 at 8:16











          • Yes I did the same

            – Md. Parvez Alam
            Mar 8 at 8:17











          • But when I give initialRouteName it returns 500 error

            – Md. Parvez Alam
            Mar 8 at 8:18













          3












          3








          3







          I can't clearly understand the problem well, but you can try adding SplashScreen in createStackNavigator() in navigation.js file



          const StackNavigator = createStackNavigator(
          loginScreen: screen: Login ,
          splashScreen: screen: SplashScreen,

          initialRouteName: 'splashScreen',

          )
          export default createAppContainer(StackNavigator);


          In your App.js file replace with this:



          const App = () => (
          <Nav /> //instead of SplashScreen
          );





          share|improve this answer















          I can't clearly understand the problem well, but you can try adding SplashScreen in createStackNavigator() in navigation.js file



          const StackNavigator = createStackNavigator(
          loginScreen: screen: Login ,
          splashScreen: screen: SplashScreen,

          initialRouteName: 'splashScreen',

          )
          export default createAppContainer(StackNavigator);


          In your App.js file replace with this:



          const App = () => (
          <Nav /> //instead of SplashScreen
          );






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 8 at 8:39

























          answered Mar 8 at 6:30









          Piyush GovilPiyush Govil

          1038




          1038












          • did that worked for you @Md. Parvez Alam?

            – Piyush Govil
            Mar 8 at 7:36











          • it says splashScreen must be react component

            – Md. Parvez Alam
            Mar 8 at 8:11











          • did you import SplashScreen in navigation.js ?

            – Piyush Govil
            Mar 8 at 8:16











          • Yes I did the same

            – Md. Parvez Alam
            Mar 8 at 8:17











          • But when I give initialRouteName it returns 500 error

            – Md. Parvez Alam
            Mar 8 at 8:18

















          • did that worked for you @Md. Parvez Alam?

            – Piyush Govil
            Mar 8 at 7:36











          • it says splashScreen must be react component

            – Md. Parvez Alam
            Mar 8 at 8:11











          • did you import SplashScreen in navigation.js ?

            – Piyush Govil
            Mar 8 at 8:16











          • Yes I did the same

            – Md. Parvez Alam
            Mar 8 at 8:17











          • But when I give initialRouteName it returns 500 error

            – Md. Parvez Alam
            Mar 8 at 8:18
















          did that worked for you @Md. Parvez Alam?

          – Piyush Govil
          Mar 8 at 7:36





          did that worked for you @Md. Parvez Alam?

          – Piyush Govil
          Mar 8 at 7:36













          it says splashScreen must be react component

          – Md. Parvez Alam
          Mar 8 at 8:11





          it says splashScreen must be react component

          – Md. Parvez Alam
          Mar 8 at 8:11













          did you import SplashScreen in navigation.js ?

          – Piyush Govil
          Mar 8 at 8:16





          did you import SplashScreen in navigation.js ?

          – Piyush Govil
          Mar 8 at 8:16













          Yes I did the same

          – Md. Parvez Alam
          Mar 8 at 8:17





          Yes I did the same

          – Md. Parvez Alam
          Mar 8 at 8:17













          But when I give initialRouteName it returns 500 error

          – Md. Parvez Alam
          Mar 8 at 8:18





          But when I give initialRouteName it returns 500 error

          – Md. Parvez Alam
          Mar 8 at 8:18













          2














          It is because your SplashScreen Component is not declared as a route in react-navigation. when you create route, you can put SplashScreen as route and set it as initial route name.






          export const Nav = createStackNavigator(

          splashScreen:
          screen: SplashScreen
          ,
          loginScreen:
          screen:Login

          ,

          initialRouteName: 'splashScreen'

          )








          share|improve this answer























          • it says splashScreen must be react component

            – Md. Parvez Alam
            Mar 8 at 8:11















          2














          It is because your SplashScreen Component is not declared as a route in react-navigation. when you create route, you can put SplashScreen as route and set it as initial route name.






          export const Nav = createStackNavigator(

          splashScreen:
          screen: SplashScreen
          ,
          loginScreen:
          screen:Login

          ,

          initialRouteName: 'splashScreen'

          )








          share|improve this answer























          • it says splashScreen must be react component

            – Md. Parvez Alam
            Mar 8 at 8:11













          2












          2








          2







          It is because your SplashScreen Component is not declared as a route in react-navigation. when you create route, you can put SplashScreen as route and set it as initial route name.






          export const Nav = createStackNavigator(

          splashScreen:
          screen: SplashScreen
          ,
          loginScreen:
          screen:Login

          ,

          initialRouteName: 'splashScreen'

          )








          share|improve this answer













          It is because your SplashScreen Component is not declared as a route in react-navigation. when you create route, you can put SplashScreen as route and set it as initial route name.






          export const Nav = createStackNavigator(

          splashScreen:
          screen: SplashScreen
          ,
          loginScreen:
          screen:Login

          ,

          initialRouteName: 'splashScreen'

          )








          export const Nav = createStackNavigator(

          splashScreen:
          screen: SplashScreen
          ,
          loginScreen:
          screen:Login

          ,

          initialRouteName: 'splashScreen'

          )





          export const Nav = createStackNavigator(

          splashScreen:
          screen: SplashScreen
          ,
          loginScreen:
          screen:Login

          ,

          initialRouteName: 'splashScreen'

          )






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 8 at 7:48









          Hazim AliHazim Ali

          3223822




          3223822












          • it says splashScreen must be react component

            – Md. Parvez Alam
            Mar 8 at 8:11

















          • it says splashScreen must be react component

            – Md. Parvez Alam
            Mar 8 at 8:11
















          it says splashScreen must be react component

          – Md. Parvez Alam
          Mar 8 at 8:11





          it says splashScreen must be react component

          – Md. Parvez Alam
          Mar 8 at 8:11











          2














          Pass the ...props when calling SplashScreen component



          import React, Component from 'react';
          import Platform, StyleSheet, Text, View from 'react-native';
          import SplashScreen from './screens/splashScreen'
          import createStackNavigator,createAppContainer from 'react-navigation'
          import Login from './screens/login'
          import Nav from './navigations'

          const App = () => (
          <SplashScreen ...props />
          );

          export default App;





          share|improve this answer























          • Not working, remove intialRoutename says says splashScreen must be react component, else if add initialRouteName says syntax error near initialRouteName

            – Md. Parvez Alam
            Mar 8 at 9:44















          2














          Pass the ...props when calling SplashScreen component



          import React, Component from 'react';
          import Platform, StyleSheet, Text, View from 'react-native';
          import SplashScreen from './screens/splashScreen'
          import createStackNavigator,createAppContainer from 'react-navigation'
          import Login from './screens/login'
          import Nav from './navigations'

          const App = () => (
          <SplashScreen ...props />
          );

          export default App;





          share|improve this answer























          • Not working, remove intialRoutename says says splashScreen must be react component, else if add initialRouteName says syntax error near initialRouteName

            – Md. Parvez Alam
            Mar 8 at 9:44













          2












          2








          2







          Pass the ...props when calling SplashScreen component



          import React, Component from 'react';
          import Platform, StyleSheet, Text, View from 'react-native';
          import SplashScreen from './screens/splashScreen'
          import createStackNavigator,createAppContainer from 'react-navigation'
          import Login from './screens/login'
          import Nav from './navigations'

          const App = () => (
          <SplashScreen ...props />
          );

          export default App;





          share|improve this answer













          Pass the ...props when calling SplashScreen component



          import React, Component from 'react';
          import Platform, StyleSheet, Text, View from 'react-native';
          import SplashScreen from './screens/splashScreen'
          import createStackNavigator,createAppContainer from 'react-navigation'
          import Login from './screens/login'
          import Nav from './navigations'

          const App = () => (
          <SplashScreen ...props />
          );

          export default App;






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 8 at 9:41









          thodwristhodwris

          143216




          143216












          • Not working, remove intialRoutename says says splashScreen must be react component, else if add initialRouteName says syntax error near initialRouteName

            – Md. Parvez Alam
            Mar 8 at 9:44

















          • Not working, remove intialRoutename says says splashScreen must be react component, else if add initialRouteName says syntax error near initialRouteName

            – Md. Parvez Alam
            Mar 8 at 9:44
















          Not working, remove intialRoutename says says splashScreen must be react component, else if add initialRouteName says syntax error near initialRouteName

          – Md. Parvez Alam
          Mar 8 at 9:44





          Not working, remove intialRoutename says says splashScreen must be react component, else if add initialRouteName says syntax error near initialRouteName

          – Md. Parvez Alam
          Mar 8 at 9:44











          1














          Try to implement this



          App.js



          import React, Component from "react";
          import Platform, StyleSheet, Text, View from "react-native";
          import SplashScreen from "./splashScreen";
          import createStackNavigator, createAppContainer from "react-navigation";
          import Nav from "./navigations";<----changes-----

          export default class App extends Component
          render()
          return (
          <Nav />
          );




          Nav.js



          import React, Component from "react";
          import createStackNavigator, createAppContainer from "react-navigation";
          import Login from "./login";
          import SplashScreen from "./splashScreen";

          //<------replace your code from here
          const Nav = createStackNavigator(

          loginScreen: screen: Login ,
          splashScreen: screen: SplashScreen
          ,

          initialRouteName: "splashScreen"

          );
          export default createAppContainer(Nav);





          share|improve this answer

























          • remove intialRoutename says says splashScreen must be react component, else if add initialRouteName says syntax error near initialRouteName

            – Md. Parvez Alam
            Mar 8 at 9:53











          • have you add splashScreen: screen: SplashScreen, in your export const Nav = createStackNavigator( loginScreen: screen:Login ) navigation.js file ?

            – Paras Korat
            Mar 8 at 9:55












          • I have updated full source code

            – Md. Parvez Alam
            Mar 8 at 9:59











          • @Md.ParvezAlam i have updated my answer

            – Paras Korat
            Mar 8 at 10:08











          • Yes changing to Nav has been done after answer given by @piyush

            – Md. Parvez Alam
            Mar 8 at 10:12















          1














          Try to implement this



          App.js



          import React, Component from "react";
          import Platform, StyleSheet, Text, View from "react-native";
          import SplashScreen from "./splashScreen";
          import createStackNavigator, createAppContainer from "react-navigation";
          import Nav from "./navigations";<----changes-----

          export default class App extends Component
          render()
          return (
          <Nav />
          );




          Nav.js



          import React, Component from "react";
          import createStackNavigator, createAppContainer from "react-navigation";
          import Login from "./login";
          import SplashScreen from "./splashScreen";

          //<------replace your code from here
          const Nav = createStackNavigator(

          loginScreen: screen: Login ,
          splashScreen: screen: SplashScreen
          ,

          initialRouteName: "splashScreen"

          );
          export default createAppContainer(Nav);





          share|improve this answer

























          • remove intialRoutename says says splashScreen must be react component, else if add initialRouteName says syntax error near initialRouteName

            – Md. Parvez Alam
            Mar 8 at 9:53











          • have you add splashScreen: screen: SplashScreen, in your export const Nav = createStackNavigator( loginScreen: screen:Login ) navigation.js file ?

            – Paras Korat
            Mar 8 at 9:55












          • I have updated full source code

            – Md. Parvez Alam
            Mar 8 at 9:59











          • @Md.ParvezAlam i have updated my answer

            – Paras Korat
            Mar 8 at 10:08











          • Yes changing to Nav has been done after answer given by @piyush

            – Md. Parvez Alam
            Mar 8 at 10:12













          1












          1








          1







          Try to implement this



          App.js



          import React, Component from "react";
          import Platform, StyleSheet, Text, View from "react-native";
          import SplashScreen from "./splashScreen";
          import createStackNavigator, createAppContainer from "react-navigation";
          import Nav from "./navigations";<----changes-----

          export default class App extends Component
          render()
          return (
          <Nav />
          );




          Nav.js



          import React, Component from "react";
          import createStackNavigator, createAppContainer from "react-navigation";
          import Login from "./login";
          import SplashScreen from "./splashScreen";

          //<------replace your code from here
          const Nav = createStackNavigator(

          loginScreen: screen: Login ,
          splashScreen: screen: SplashScreen
          ,

          initialRouteName: "splashScreen"

          );
          export default createAppContainer(Nav);





          share|improve this answer















          Try to implement this



          App.js



          import React, Component from "react";
          import Platform, StyleSheet, Text, View from "react-native";
          import SplashScreen from "./splashScreen";
          import createStackNavigator, createAppContainer from "react-navigation";
          import Nav from "./navigations";<----changes-----

          export default class App extends Component
          render()
          return (
          <Nav />
          );




          Nav.js



          import React, Component from "react";
          import createStackNavigator, createAppContainer from "react-navigation";
          import Login from "./login";
          import SplashScreen from "./splashScreen";

          //<------replace your code from here
          const Nav = createStackNavigator(

          loginScreen: screen: Login ,
          splashScreen: screen: SplashScreen
          ,

          initialRouteName: "splashScreen"

          );
          export default createAppContainer(Nav);






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 8 at 10:38

























          answered Mar 8 at 9:51









          Paras KoratParas Korat

          8191524




          8191524












          • remove intialRoutename says says splashScreen must be react component, else if add initialRouteName says syntax error near initialRouteName

            – Md. Parvez Alam
            Mar 8 at 9:53











          • have you add splashScreen: screen: SplashScreen, in your export const Nav = createStackNavigator( loginScreen: screen:Login ) navigation.js file ?

            – Paras Korat
            Mar 8 at 9:55












          • I have updated full source code

            – Md. Parvez Alam
            Mar 8 at 9:59











          • @Md.ParvezAlam i have updated my answer

            – Paras Korat
            Mar 8 at 10:08











          • Yes changing to Nav has been done after answer given by @piyush

            – Md. Parvez Alam
            Mar 8 at 10:12

















          • remove intialRoutename says says splashScreen must be react component, else if add initialRouteName says syntax error near initialRouteName

            – Md. Parvez Alam
            Mar 8 at 9:53











          • have you add splashScreen: screen: SplashScreen, in your export const Nav = createStackNavigator( loginScreen: screen:Login ) navigation.js file ?

            – Paras Korat
            Mar 8 at 9:55












          • I have updated full source code

            – Md. Parvez Alam
            Mar 8 at 9:59











          • @Md.ParvezAlam i have updated my answer

            – Paras Korat
            Mar 8 at 10:08











          • Yes changing to Nav has been done after answer given by @piyush

            – Md. Parvez Alam
            Mar 8 at 10:12
















          remove intialRoutename says says splashScreen must be react component, else if add initialRouteName says syntax error near initialRouteName

          – Md. Parvez Alam
          Mar 8 at 9:53





          remove intialRoutename says says splashScreen must be react component, else if add initialRouteName says syntax error near initialRouteName

          – Md. Parvez Alam
          Mar 8 at 9:53













          have you add splashScreen: screen: SplashScreen, in your export const Nav = createStackNavigator( loginScreen: screen:Login ) navigation.js file ?

          – Paras Korat
          Mar 8 at 9:55






          have you add splashScreen: screen: SplashScreen, in your export const Nav = createStackNavigator( loginScreen: screen:Login ) navigation.js file ?

          – Paras Korat
          Mar 8 at 9:55














          I have updated full source code

          – Md. Parvez Alam
          Mar 8 at 9:59





          I have updated full source code

          – Md. Parvez Alam
          Mar 8 at 9:59













          @Md.ParvezAlam i have updated my answer

          – Paras Korat
          Mar 8 at 10:08





          @Md.ParvezAlam i have updated my answer

          – Paras Korat
          Mar 8 at 10:08













          Yes changing to Nav has been done after answer given by @piyush

          – Md. Parvez Alam
          Mar 8 at 10:12





          Yes changing to Nav has been done after answer given by @piyush

          – Md. Parvez Alam
          Mar 8 at 10:12











          1














          The main issue was I was importing navigations.js in screen files.



          Thanks all for your valuable comments I learned lots of things from you brothers






          share|improve this answer























          • Happy to help :)

            – Piyush Govil
            Mar 8 at 11:00















          1














          The main issue was I was importing navigations.js in screen files.



          Thanks all for your valuable comments I learned lots of things from you brothers






          share|improve this answer























          • Happy to help :)

            – Piyush Govil
            Mar 8 at 11:00













          1












          1








          1







          The main issue was I was importing navigations.js in screen files.



          Thanks all for your valuable comments I learned lots of things from you brothers






          share|improve this answer













          The main issue was I was importing navigations.js in screen files.



          Thanks all for your valuable comments I learned lots of things from you brothers







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 8 at 10:39









          Md. Parvez AlamMd. Parvez Alam

          1,85121338




          1,85121338












          • Happy to help :)

            – Piyush Govil
            Mar 8 at 11:00

















          • Happy to help :)

            – Piyush Govil
            Mar 8 at 11:00
















          Happy to help :)

          – Piyush Govil
          Mar 8 at 11:00





          Happy to help :)

          – Piyush Govil
          Mar 8 at 11:00

















          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.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55057548%2freact-native-this-props-navigation-navigate-undefined%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

          1928 у кіно

          Захаров Федір Захарович

          Ель Греко