1 Star 0 Fork 71

bygreencn/oscApp

forked from lclz/oscApp 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
home.js 2.95 KB
一键复制 编辑 原始数据 按行查看 历史
lilw 提交于 2016-01-19 18:42 . init
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
'use strict';
import NavigatorWrapper from "./ios_views/common/NavigatorWrapper"
import News from "./ios_views/news/news_list"
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
View,
TabBarIOS,
StatusBarIOS
} = React;
//StatusBarIOS.setStyle({backgroundColor:'#4ead7d'});
module.exports = React.createClass({
getInitialState:function(){
return {
selectedTab:"综合"
}
},
_renderContent:function(contentTab,color){
return (
<View style={styles.contentTab}>
<Text style={[styles.contentText,{color:color}]}>{contentTab}</Text>
</View>
)
},
render: function() {
return (
<TabBarIOS
style={{elevation:1000}}
translucent={false}>
<TabBarIOS.Item
title="综合"
icon={this.state.selectedTab==="综合"?require('image!tabbar-news-selected'):require('image!tabbar-news')}
selected={this.state.selectedTab === "综合"}
onPress={()=>{
this.setState({
selectedTab:"综合"
})
}}>
<News navigator={this.props.navigator} route={this.props.route} {...this.props.route.passProps}/>
</TabBarIOS.Item>
<TabBarIOS.Item
title="动弹"
icon={this.state.selectedTab==="动弹"?require('image!tabbar-tweet-selected'):require('image!tabbar-tweet')}
selected={this.state.selectedTab === "动弹"}
onPress={()=>{
this.setState({
selectedTab:"动弹"
})
}}>
{this._renderContent("动弹","#eb3219")}
</TabBarIOS.Item>
<TabBarIOS.Item
title="发现"
icon={this.state.selectedTab==="发现"?require('image!tabbar-discover-selected'):require('image!tabbar-discover')}
selected={this.state.selectedTab === "发现"}
onPress={()=>{
this.setState({
selectedTab:"发现"
})
}}>
{this._renderContent("发现","#eb3219")}
</TabBarIOS.Item>
<TabBarIOS.Item
title="我的"
icon={this.state.selectedTab==="我的"?require('image!tabbar-me-selected'):require('image!tabbar-me')}
selected={this.state.selectedTab === "我的"}
onPress={()=>{
this.setState({
selectedTab:"我的"
})
}}>
{this._renderContent("我的","#eb3219")}
</TabBarIOS.Item>
</TabBarIOS>
);
}
});
var styles = StyleSheet.create({
contentTab:{
flex:1,
alignItems:'center',//水平居中
justifyContent:'center'//垂直居中
},
contentText:{
},
});
//AppRegistry.registerComponent('oscApp', () => oscApp);
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/bygreencn/oscApp.git
git@gitee.com:bygreencn/oscApp.git
bygreencn
oscApp
oscApp
master

搜索帮助