在入口初始化
import { AppRegistry, StyleSheet, Text, View } from 'react-native';
import React, { Component } from 'react';
import { Image } from 'react-native';
import Home from './app/home/Home'
import App from './App'
import Profile from './app/home/Profile'
import Detail from './app/detail/Detail'
import { createStackNavigator, createAppContainer } from 'react-navigation';
const MainNavigator = createStackNavigator({
Home: Home,
App: App,
Profile: Profile,
Detail: Detail,
},
{
initialRouteName: "App"
});
const AppContainer = createAppContainer(MainNavigator);
AppRegistry.registerComponent('MyReactNativeApp', () => AppContainer);
路由是全局的初始化一次即可,然后进行页面跳转
export default class home extends React.Component {
render() {