React-native How To Put Your Icon In iOS TabBar

471 views Asked by At

the problem I'm facing is I want to put my own icons in the Tab Bar iOS component. I read the API which says I need to assign the property icon, with the variable of type Image.propTypes.source. Although I'm still getting "Unexpected token"

Snippet of Code:

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

There are 1 answers

0
ivillamil On

Wrap the icon path with the require function.

icon={require('./img/ios-calls.png')}