0

I have a problem With this. I am very new to react-native. I am Building react native app. In there I have used React navigation.

This is my pakage.json file.

{
  "name": "empty-project-template",
  "main": "node_modules/expo/AppEntry.js",
  "private": true,
  "scripts": {
    "start": "expo start",
    "eject": "expo eject",
    "android": "expo start --android",
    "ios": "expo start --ios"
  },
  "dependencies": {
    "expo": "^30.0.1",
    "react": "16.3.1",
    "react-native": "^0.57.3",
    "react-navigation": "^3.0.0-alpha.6"
  }
}

This is my App.js file.

import React from 'react';
import Route from './src/routes';


export default class App extends React.Component {
  render() {
    return (
      <Route/>
    );
  }
}

And There I have created a Home.js file.

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';

export default class Home extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        Add friends here!
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

There I have created route.js file like this.

import { createStackNavigator } from 'react-navigation';
import HomeScreen from './components/Home';

const Route = createStackNavigator({
    Home: { screen: HomeScreen }
});

export default  Route;

After Creating These files.When I hit expo start --android It load nothing on the simulator. It just stuck on the loading screen. Can someone help me to solve this problem? Thank You!!!

1 Answer 1

1

Try adding initial route

const Route = createStackNavigator({
    Home: { screen: HomeScreen }
},
{
   initialRouteName: "Home",

});
Sign up to request clarification or add additional context in comments.

1 Comment

Also wrap your text in <Text></tText>. Change the background color to #000 to see if there is a difference. Maybe all works but your view is just white?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.