App.js 956 Bytes
import React, { Component } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { createAppContainer } from 'react-navigation';
import { createStackNavigator } from 'react-navigation-stack'
// import MainScreen from './components/MainScreen';
import Login from './source/Login';
import MainScreen from './source/MainScreen';
import {getId} from './source/component/DBhelper'

// const AppStackNavigator = createStackNavigator({
//   Main:{
//     screen: MainScreen // MainScreen 컴포넌트를 네비게이터에 등록
//   }
// });

// export default createAppContainer(AppStackNavigator);

var initialName = ''

if(getId() == true){
  initialName = 'MainScreen'
}
else initialName = 'Login'

const MainNavigator = createStackNavigator({
  Login : {screen: Login},
  MainScreen : {screen:MainScreen},
},
  {initialRouteName: initialName,headerMode:'none'}
);

const App = createAppContainer(MainNavigator);

export default App;