|
@@ -0,0 +1,42 @@
|
|
|
+import React,{Component} from 'react';
|
|
|
+
|
|
|
+import {View,Text} from 'react-native';
|
|
|
+
|
|
|
+import LeanCloudAPI from '../../leancloud'
|
|
|
+
|
|
|
+//中间跳转页 。。。
|
|
|
+
|
|
|
+class Welcome extends Component {
|
|
|
+ constructor(props){
|
|
|
+ super(props)
|
|
|
+ }
|
|
|
+ static navigationOptions = {title: 'Welcome',header:null}
|
|
|
+
|
|
|
+ async componentWillMount(){
|
|
|
+ const {navigation} =this.props
|
|
|
+ let ret = await LeanCloudAPI.isLogin()
|
|
|
+ let routeName="StackNavigator"
|
|
|
+ if(!ret){
|
|
|
+
|
|
|
+ routeName="Login"
|
|
|
+ }else{
|
|
|
+ LeanCloudAPI.createIMClient()
|
|
|
+ navigation.dispatch({type:'USER',user:ret})
|
|
|
+ routeName="StackNavigator"
|
|
|
+ }
|
|
|
+
|
|
|
+ setTimeout(()=>{
|
|
|
+ navigation.navigate({ routeName })
|
|
|
+ },2000)
|
|
|
+ }
|
|
|
+
|
|
|
+ render(){
|
|
|
+ return(
|
|
|
+ <View style={{flex:1,justifyContent:"center",alignItems:"center"}}>
|
|
|
+ <Text>欢迎页面,处理登录逻辑跳转</Text>
|
|
|
+ </View>
|
|
|
+ )
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export default Welcome;
|