如何在使用React Native Navigation时为Tab栏图标设置自定义图标高度?

时间:2018-01-24 06:01:58

标签: react-native react-native-navigation

有没有办法为标签栏按钮设置自定义图标的高度和宽度?

谢谢!

search() {
return {
  name: 'search',
  screen: 'entry.Entry',
  title: "Entry",
  titleImage: true,
  navigatorButtons: {
    leftButtons: [{
      id: 'back-button',
      component: 'entry.BackButton'
    }]
  },
  icon: require("./navigationAssets/searchIconInactive.png"),
  selectedIcon: require(./navigationAssets/searchIconActive.png")
};

}

1 个答案:

答案 0 :(得分:0)

你关注代码

static navigationOptions = {
    tabBarLabel: 'Home',
    // Note: By default the icon is only shown on iOS. Search the showIcon option below.
    tabBarIcon: ({ tintColor }) => (
      <Image
        source={require('./chats-icon.png')}
        style={[styles.icon, {tintColor: tintColor}]}
      />
    ),
  };

参考此链接。 https://reactnavigation.org/docs/navigators/tab

我希望对你有所帮助