【问题标题】:Change icon in react-native-navigation tab更改 react-native-navigation 选项卡中的图标
【发布时间】:2017-12-13 23:39:51
【问题描述】:

是否可以更改react-native-navigation 标签栏中的图标?
我的意思是,例如,在我的应用程序的某个地方,我确实调用了 api,在得到响应后,我需要将标签栏中的 Icon 更改为新的。
例如 Heart 图标到 Mail 图标。

感谢任何形式的帮助!

【问题讨论】:

  • 给我们一些代码,伙计!

标签: react-native react-native-navigation wix-react-native-navigation


【解决方案1】:

使用setTabButton

this.props.navigator.setTabButton({
  tabIndex: 0, // (optional) if missing, the icon will be added to this screen's tab
  icon: require('../img/one.png'), // local image asset for the tab icon unselected state (optional)
  selectedIcon: require('../img/one_selected.png'), // local image asset for the tab icon selected state (optional, iOS only)
  label: 'New Label' // tab label that appears under the icon (optional)
});

【讨论】:

  • @АндрейГузюк 如何更改图标的颜色。我只看到一个蓝色图标。但是图标是黑色的。
  • 通过设置这个属性找到了解决方案disableIconTint: true
猜你喜欢
  • 1970-01-01
  • 2018-05-12
  • 1970-01-01
  • 1970-01-01
  • 2019-01-23
  • 1970-01-01
  • 2018-02-21
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多