'use strict';

'use strict';
import React, {
  AppRegistry,
  Component,
  StyleSheet,
  Text,
  View,
  NavigatorIOS,
  StatusBarIOS
} from 'react-native';

import Login from '../views/Login';

import Config from '../services/config.js';

StatusBarIOS.setStyle('light-content');

class UFNavigator extends Component {
  constructor(props) {
    super(props);
    this.state = {
      loggedIn: true
    };
  }
  _loggedIn() {
    this.setState({loggedIn: true});
  }
  _renderNavigation() {
    return (
      <NavigatorIOS
        style={{flex: 1}}
        barTintColor={Config.Style.PrimaryColor}
        titleTextColor="white"
        translucent={false}
        initialRoute={{
          component: this.props.component,
          title: 'Unfollowers',
          passProps: { myProp: 'foo' },
        }}
      />
    );
  }
  _renderLogin() {
    var _this = this;
    return (
      <Login loggedIn={function(){_this._loggedIn()}} />
    )
  }
  render(){
    if (this.state.loggedIn) {
      return this._renderNavigation();
    } else {
      return this._renderLogin();
    }
  }
}

export default UFNavigator;
