Fetch the repository succeeded.
'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;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。