React-native如何将您的图标放在iOS TabBar中

时间:2017-07-02 08:01:25

标签: react-native react-native-ios tabbarios

我面临的问题是我想在Tab Bar iOS组件中放置自己的图标。 我阅读了API,其中说我需要使用icon类型的变量来分配属性Image.propTypes.source。虽然我仍然得到"意外的令牌"

代码片段:

      <TabBarIOS.Item
      icon = {'./img/ios-calls.png'};
      selected = {this.state.tab === "Calls"}
      onPress = { () => this.setState({ tab: 'Calls'})}
      title = "Calls"
      >

1 个答案:

答案 0 :(得分:0)

使用require函数包装图标路径。

array (
  0 => 
  array (
    'Customer' => 
    array (
      'created_by' => 5,
      'amount' => 199,
      'name' => 'First Cux',
    ),
  ),
  1 => 
  array (
    'Customer' => 
    array (
      'created_by' => 1,
      'amount' => 199,
      'name' => 'Last Cux',
      'refund_amount' => 100,
      'company' => 'First Company',
    ),
  ),
  2 => 
  array (
    'Customer' => 
    array (
      'created_by' => 3,
      'refund_amount' => 250,
      'company' => 'Last Company',
    ),
  ),
)