43 Star 136 Fork 53

0-hun/DotaVideo

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
app.js 2.53 KB
Copy Edit Raw Blame History
0-hun authored 2016-05-14 15:42 . 完成用户中心 和 搜索
'use strict';
var React = require('react-native');
import Home from './app/Screens/home';
import TopList from './app/Screens/topList';
import Users from './app/Screens/users';
import UserVideo from './app/Screens/userVideos';
import Video from './app/Screens/video';
import Web from './app/Screens/web';
import Login from './app/Screens/login';
import UserCenter from './app/Screens/userCenter';
import Search from './app/Screens/search';
import Main from './app/common/Main';
var {
Navigator,
AsyncStorage
} = React;
var App = React.createClass({
getInitialState:function(){
return {
userinfo:{}
}
},
renderScene(router, navigator){
var Component = null;this._navigator = navigator;
switch(router.name){
case "Home":
Component = Home;
break;
case "TopList":
Component = TopList;
break;
case "Users":
Component = Users;
break;
case "UserVideo":
Component = UserVideo;
break;
case "Video":
Component = Video;
break;
case "Web":
Component = Web;
break;
case "Login":
Component = Login;
break;
case "UserCenter":
Component = UserCenter;
break;
case "Search":
Component = Search;
break;
default: //default view
Component = Home;
}
return <Component navigator={navigator} {...router.passProps} app={this}/>
},
componentDidMount:function(){
AsyncStorage.getItem('_user',(err,res)=>{
//console.log("componentDidMount",res);
if(err!=null)
return;
this.setState({
userinfo:JSON.parse(res)
});
});
},
_render:function(){
return (
<Navigator
initialRoute={{name: 'Home'}}
userinfo={this.state.userinfo}
renderScene={this.renderScene}
configureScene={(route) => {
if (route.sceneConfig) {
return route.sceneConfig;
}
return Navigator.SceneConfigs.FadeAndroid;
}}
/>
);
},
render() {
//console.log(this.state.userinfo);
return this._render();
}
});
module.exports = App;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
NodeJS
1
https://gitee.com/man0sions/DotaVideo.git
git@gitee.com:man0sions/DotaVideo.git
man0sions
DotaVideo
DotaVideo
master

Search

0d507c66 1850385 C8b1a773 1850385