React Native TabBarIOS.Item自定义图标不起作用

时间:2016-05-17 14:36:06

标签: android ios reactjs react-native

我在react-native中使用自定义图标(icon.png)实现TabBarIOS.Item时遇到问题。我可以看到一个白色圆圈,但没有图像。

<TabBarIOS
  barTintColor="darkslateblue"
  tintColor="white"
>
  <TabBarIOS.Item
    icon={require('./images/icon.png')}
    onPress={() => { this.setState({ selectedTab: 'blueTab' }); }}
    selected={this.state.selectedTab === 'blueTab'}
    title="Tab1"
  >
    {this._renderContent('#414A8C', 'Blue Tab')}
  </TabBarIOS.Item>
  <TabBarIOS.Item
    badge={this.state.notifCount > 0 ? this.state.notifCount : undefined}
    onPress={() => { this.setState({ selectedTab: 'redTab', notifCount: this.state.notifCount + 1 }); }}
    selected={this.state.selectedTab === 'redTab'}
    systemIcon="history"
  >
    {this._renderContent('#783E33', 'Red Tab', this.state.notifCount)}
  </TabBarIOS.Item>
  <TabBarIOS.Item
    icon={{uri: base64Icon, scale: 3}}
    onPress={() => { this.setState({ selectedTab: 'greenTab', presses: this.state.presses + 1 }); }}
    selected={this.state.selectedTab === 'greenTab'}
    title="More"
  >
    {this._renderContent('#21551C', 'Green Tab', this.state.presses)}
  </TabBarIOS.Item>
</TabBarIOS>

图标

enter image description here

模拟器上的输出

enter image description here

请帮我解决这个问题。

0 个答案:

没有答案