'use strict';

import {createStackNavigator} from 'react-navigation-stack';
import NavigationOptions from '../../components/NavbarOptions';
import SalesHome from './Home';
import ReportCustomerList from './ReportCustomerList';
import ReportCustomerDetail from './ReportCustomerDetail';
import ReportCustomerAdd from './ReportCustomerAdd';
import SearchProject from './SearchProject';

const HomeStack = createStackNavigator({
        SalesHome: {
            screen: SalesHome,
            navigationOptions: {
                title: '首页',
            },
        },
        ReportCustomerList: {
            screen: ReportCustomerList,
            navigationOptions: {
                title: '客户报备',
            },
        },
        ReportCustomerDetail: {
            screen: ReportCustomerDetail,
            navigationOptions: {
                title: '客户报备明细',
            },
        },
        ReportCustomerAdd: {
            screen: ReportCustomerAdd,
            navigationOptions: {
                title: '报备客户',
            },
        },
        SearchProject: {
            screen: SearchProject,
            navigationOptions: {
                title: '选择项目',
            },
        },
    },
    {
        initialRouteName: 'SalesHome',
        defaultNavigationOptions: NavigationOptions,
        //mode: 'modal',
        //headerMode: 'none',
    },
);

HomeStack.navigationOptions = ({navigation}) => {  // ~注意~ 如果想实现隐藏Tabbar的功能要调用这个方法
    let tabBarVisible = true;
    if (navigation.state.index > 0) {
        tabBarVisible = false;
    }
    return {
        tabBarVisible,
    };
};


module.exports = HomeStack;
