oblador / react-native-vector-icons

Customizable Icons for React Native with support for image source and full styling.
https://oblador.github.io/react-native-vector-icons/
MIT License
17.45k stars 2.12k forks source link

it seems like Icon.TabBarItem's problem #225

Closed ha-family closed 4 years ago

ha-family commented 8 years ago

i've got some weird problem, can't find any relevant issue on google. error occurs when i selected the Icon.TabBarItem

error messge

and when change Icon.TabBarItem to TabBarIOS.Item then it works fine.

part of my code below

var Nav = {
  attr: { tintColor: '#fff', barTintColor: '#fff', titleTextColor:'#666'},
  home: { icon: { title: '首頁', iconName: 'ios-home-outline', selectedIconName:'ios-home'}, index: 'HOME' , name: '中古汽車首頁'},
  buy:  { icon: { title: '買車', iconName: 'ios-car', selectedIconName:'ios-car'}, index: 'BUY_CAR' , name: '買車'},
  sell: { icon: { title: '賣車', iconName: 'ios-pricetags-outline', selectedIconName:'ios-pricetags'}, index: 'SELL_CAR' , name: '賣車'},
  blog: { icon: { title: '車訊', iconName: 'ios-bookmarks-outline', selectedIconName:'ios-bookmarks'}, index: 'CAR_BLOG' , name: '汽車百科'},
  personal: { icon: { title: '我的', iconName: 'ios-person-outline', selectedIconName:'ios-person'}, index: 'MY' , name: '我的'}
};

<TabBarIOS tintColor="#EF5350">
        <Icon.TabBarItem
                  title={Nav.home.icon.title}
                  iconSize={28}
                  iconName={Nav.home.icon.iconName}
                  selectedIconName={Nav.home.icon.selectedIconName}
                  selected={this.state.selectedTab === Nav.home.index}
                  onPress={() => {
                    if (this.state.selectedTab !== Nav.home.index) {
                      this.setState({
                        selectedTab: Nav.home.index,
                        active: Nav.home.index,
                      });
                    } else if (this.state.selectedTab === Nav.home.index) {
                      //this.refs.homeRef.popToTop();
                    }

                  }}>

          {  (this.state.active == Nav.home.index) && this._renderHome()  }
        </Icon.TabBarItem>
        <Icon.TabBarItem
          title={Nav.buy.icon.title}
          iconSize={28}
          iconName={Nav.buy.icon.iconName}
          selectedIconName={Nav.buy.icon.selectedIconName}
          selected={this.state.selectedTab === Nav.buy.index}
          onPress={() => {
            if (this.state.selectedTab !== Nav.buy.index) {
              this.setState({ 
                selectedTab: Nav.buy.index, 
                active: Nav.buy.index 
              });
            } else if (this.state.selectedTab === Nav.buy.index) {
              //this.refs.buyRef.popToTop();
            }
          }}>

          { (this.state.active == Nav.buy.index) && this._renderBuy() }
        </Icon.TabBarItem>
</TabBarIOS>

does anyone have the same question?

szholdiyarov commented 4 years ago

Closing this issue due to inactivity.