不确定您到底要做什么。要让 tabBarIOS 工作,您需要按照您所说的开始
var {
AppRegistry,
StyleSheet,
Text,
View,
NavigatorIOS,
TabBarIOS,
} = React;
然后创建你的类。Then create your constructor which starts which tab you want to be selected then you need to make methods that change the selected tab - when a tab is selected it is blue. 然后你的渲染返回每个 TabBarIOS,在每个 TabBarIOS.item 内,你必须调用你想要它去的页面
class example extends React.Component{
constructor(props){
super(props)
this.state = {
selectedTab: 'sassi',
}
}
homeHandleChange(){
this.setState({
selectedTab: 'home',
})
};
aboutHandleChange(){
this.setState({
selectedTab: 'about',
})
};
creditHandleChange(){
this.setState({
selectedTab: 'credits',
})
};
render() {
return (
<View style={styles.container}>
<View style={styles.footer}>
<TabBarIOS>
<TabBarIOS.Item
title="home List"
selected={this.state.selectedTab === "home"}
icon={require("./App/assets/youricon.png")}
onPress={this.homeHandleChange.bind(this)} >
<View style={styles.main}>
<home></home>
</View>
</TabBarIOS.Item>
<TabBarIOS.Item
title="credits"
selected={this.state.selectedTab === "credits"}
icon={require("./App/assets/yourIcon.png")}
onPress={this.creditsHandleChange.bind(this)} >
<View style={styles.main}>
<credits></credits>
</View>
</TabBarIOS.Item>
<TabBarIOS.Item
title="About"
selected={this.state.selectedTab === "about"}
icon={require("./App/assets/aboutIcon.png")}
onPress={this.aboutHandleChange.bind(this)} >
<View style={styles.main}>
<About></About>
</View>
</TabBarIOS.Item>
</TabBarIOS>
</View>
</View>
);
}
};