图标在createMaterialTopTabNavigator中不起作用

时间:2019-04-19 18:18:08

标签: reactjs react-native react-navigation

我想在标签中显示图标,但是当我将showIcon:true放在tabBarOptions中时,我看到此错误:

  

找不到变量:React

const MenStack = createStackNavigator({
  menStackNav: { screen: MenTabScreen,    navigationOptions:{tabBarVisible: false},
},
  Products: {
    screen: ProductsShow,
    navigationOptions:{tabBarVisible: false},
  },
},{
  initialRouteName: 'menStackNav',
  headerMode: 'none',
  navigationOptions: {
    headerVisible: false,
  }
});

MenStack.navigationOptions = ({navigation}) => {
      let tabBarVisible = true;
      if(navigation.state.index > 0){
        tabBarVisible = false;
      }

      return {
        tabBarVisible,
      }
}

const HomeScreenTabs = createMaterialTopTabNavigator({
  Home:{
    screen:HomeTabScreen,
    navigationOptions: {
      tabBarIcon:<Icon name="home" size={30} color="#900" />
    }
  },
  Women: {
    screen:WomenTabScreen,
  },
  Men: {
    screen:MenStack,
  },

},{
  tabBarOptions: {
    showIcon:true,
    style:{backgroundColor:'#fff'},
    activeTintColor: '#0077FF',
    inactiveTintColor: '#0077FF60',
    indicatorStyle: {
      opacity: 0
    },
    tabStyle:{backgroundColor:'#fff',height:40,borderBottomColor:'#fff'},
    labelStyle: {
      borderBottomColor:'#fff',
        border:0,
        fontSize: 14,
        fontFamily:'iransans_medium',
      },
  },
    initialRouteName: 'Men',
    mode: 'modal',
    headerMode: 'none',
});

0 个答案:

没有答案