I am new to React and trying to follow this Tutorial.Apparently, It's for an older version of react-native. so Im following and tweaking the code when it's not working. I'm using ReactNative 0.41
.
my index.ios.js:
import React, { Component } from 'react';
import {
AppRegistry,
TabBarIOS
} from 'react-native';
import Featured from './Featured';
import Search from './Search';
class BookSearch extends Component {
constructor(props) {
super(props);
this.state = {
selectedTab: 'featured'
};
}
render() {
return (
<TabBarIOS selectedTab={this.state.selectedTab}>
<TabBarIOS.Item
selected={this.state.selectedTab === 'featured'}
icon={{uri:'featured'}}
onPress={() => {
this.setState({
selectedTab: 'featured'
});
}}>
<Featured/>
</TabBarIOS.Item>
<TabBarIOS.Item
selected={this.state.selectedTab === 'search'}
icon={{uri:'search'}}
onPress={() => {
this.setState({
selectedTab: 'search'
});
}}>
<Search/>
</TabBarIOS.Item>
</TabBarIOS>
);
}
}
AppRegistry.registerComponent('BookSearch', () => BookSearch);
and here is the Error:
As suspected the error was due to syntax change. the new version uses
systemIcon='featured'
instead oficon={{uri:'featured'}}