Ver código fonte

首屏 调整页面, 处理 是否登录,数据加载 等。。。一系列问题

wennjie 6 anos atrás
pai
commit
0505aad818
1 arquivos alterados com 42 adições e 0 exclusões
  1. 42 0
      huiliaoAPP/src/pages/Welcome/index.js

+ 42 - 0
huiliaoAPP/src/pages/Welcome/index.js

@@ -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;