I am using TabBarIOS in react native,and running it on android emulator, but while using TabBarIOS.Item I am getting following error Element type is invalid expected a string(for built in components) or a class/function (for composite functions) but got undefined check render method of Approvals
render() method of Approvals is as follows
render(){
return (
<View style={styles.container}>
<View style={styles.strip}>
<Image style={{width:50, height:30,padding:10,top:5}} source={require('./drawable/drawable/asap.png')}/>
<Text style={{fontSize:20,color:'white',bottom:20,left:60,padding:10}}>Approvals</Text>
</View>
<TabBarIOS selectedTab={this.state.selectedTab}>
<TabBarIOS.Item
title="Pending"
icon={{uri:'./drawable/drawable/approvalbadge.png',scale:3}}
selected={this.state.selectedTab==='pending'}
onPress={() => {
this.setState({
selectedTab: 'pending',
});
}}>
<Pending>
</TabBarIOS.Item>
</TabBarIOS>
</View>
);
}
The error is in this section only cause if I remove TabBarIOS and place it doesn't give any error. Please Help me to solve this issue.
When you import TabBarIOS it is imported as undefined, because you can not use it in android app. Than you call
it is interpreted as
undefined
You better use external implementation instead (something like https://github.com/exponentjs/react-native-tab-navigator) or write your own.