小编the*_*ter的帖子

React Native中的TabBarBottom不显示图标/图像

我几乎从TabNavigator文档中获取了示例代码,而图标/图像根本没有出现在iOS或Android上.即使标签覆盖似乎也没有生效.我究竟做错了什么?

在此输入图像描述

这是我一直在使用的文档的链接:https: //reactnavigation.org/docs/navigators/tab

这是我的代码:

class MyHomeScreen extends React.Component {
  static navigationOptions = {
    tabBarLabel: 'Not displayed',
    // 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}]}
      />
    ),
  };

  render() {
    return (
      <Button
        onPress={() => this.props.navigation.navigate('Notifications')}
        title="Go to notifications"
      />
    );
  }
}

class MyNotificationsScreen extends React.Component {
  static navigationOptions = {
    tabBarLabel: 'Notifications',
    tabBarIcon: ({ tintColor }) => ( …
Run Code Online (Sandbox Code Playgroud)

react-native react-navigation

7
推荐指数
1
解决办法
4533
查看次数

标签 统计

react-native ×1

react-navigation ×1