页脚标签导航

时间:2018-01-04 07:49:31

标签: reactjs react-native

这是我的页脚标签代码,同时检查是否有其他条件我要检查用户ID,我将在导出默认MainScreenNavigator = TabNavigator()中保存用户ID?

如果我在导出默认值MainScreenNavigator = TabNavigator()内保存,那么它会抛出错误的意外令牌。 如果我在导出默认值MainScreenNavigator = TabNavigator()内保存,那么它会抛出错误的意外令牌。 如果我保存在导出默认值(MainScreenNavigator = TabNavigator()内,那么它会抛出错误的意外令牌。 如果我保存在导出默认值(MainScreenNavigator = TabNavigator()内,那么它会抛出错误的意外令牌。  如果我保存在导出默认值(MainScreenNavigator = TabNavigator()内,那么它会抛出错误的意外令牌。  如果我保存在导出默认值(MainScreenNavigator = TabNavigator()内,那么它会抛出错误的意外令牌。  如果我保存在导出默认值(MainScreenNavigator = TabNavigator()内,那么它会抛出错误的意外令牌。

    import React, { Component,AsyncStorage } from "react";
    import Home from "./Home.js";
    import Schedule from "./Schedule.js";
    import Account from "./Account.js";
    import Location from "./Location.js";
    import Profile from "./Profile.js";
    import { TabNavigator } from "react-navigation";
    import {
      Button,
      Text,
      Icon,
      Item,
      Footer,
      FooterTab,
      Label
    } from "native-base";


    import styles from "../../css/style";



    export default (MainScreenNavigator = TabNavigator(



      { 
        Home: { screen: Home},
        Schedule: { screen: Schedule },
        Account: { screen: Account },
        Location: { screen: Location },
        Profile: { screen: Profile }
      },
      {
        tabBarPosition: "bottom",
        tabBarComponent: props => {
          return (

            <Footer>
              <FooterTab>
                <Button
                  vertical
                  active={props.navigationState.index === 1}
                  onPress={() => props.navigation.navigate("Schedule")}
                >
                  <Icon name="calendar" />
                  <Text>Schedule</Text>
                </Button>



                <Button
                  vertical
                  active={props.navigationState.index === 2}
                  onPress={() => {
                    if (props.navigationState.index === false) {
                      alert('Hi');
                      props.navigation.navigate("Account")
                    } else {
                      alert('Yes');
                      props.navigation.navigate("Login")
                    }
                  }}>
                  <Icon name="barcode" />
                  <Text>Account</Text>
                </Button>



                <Button
                  vertical
                  active={props.navigationState.index === 3}
                  onPress={() => props.navigation.navigate("Location")}
                >
                  <Icon name="ios-navigate-outline" />
                  <Text>Location</Text>
                </Button>



                <Button
                  vertical
                  active={props.navigationState.index === 4}
                  onPress={() => {
                    if (props.navigationState.index === false) {
                      alert('Hi');
                      props.navigation.navigate("Profile")
                    } else {
                      alert('Yes');
                      props.navigation.navigate("Login")
                    }
                  }}>
                  <Icon name="person" />
                  <Text>Profile</Text>
                </Button>


              </FooterTab>
            </Footer>
          );
        }
      }
    ));

0 个答案:

没有答案