140 Star 511 Fork 159

rplees/react-native-gitosc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
RootTab.js 1.42 KB
一键复制 编辑 原始数据 按行查看 历史
rplees 提交于 2016-04-19 17:58 . android 适配1
/**
* Created by rplees on 3/8/16.
*/
const React = require('react-native');
const Routes = require('../components/Routes');
const Ionicons = require('react-native-vector-icons/Ionicons');
const constant = require('../config').constant;
const TabBarDic = [constant.scene.project.key, constant.scene.famous.key, constant.scene.personal.key];//
const {
TabBarIOS
} = React;
const RootTab = React.createClass({
getInitialState() {
return {
selectedTab:TabBarDic[0],
}
},
componentDidMount() {
},
render() {
let cp = TabBarDic.map((v, i) => {
var routeCfg = Routes.getRouteCfg(v);
return <Ionicons.TabBarItem
key={'iconTabBarItem_' + v}
iconName={routeCfg.iconName}
selectedIconName={routeCfg.selectedIconName}
title={routeCfg.tabName}
selected={this.state.selectedTab === v}
onPress={() => {
this.setState({
selectedTab: v,
});
//Pop to the first scene in the stack, unmounting every other scene
this.refs["navigator_" + v] && this.refs["navigator_" + v].popToTop();
}}>
{Routes.navigator(v)}
</Ionicons.TabBarItem>
}
);
return <TabBarIOS>{cp}</TabBarIOS>
}
});
module.exports = RootTab;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/rplees/react-native-gitosc.git
git@gitee.com:rplees/react-native-gitosc.git
rplees
react-native-gitosc
react-native-gitosc
master

搜索帮助