import React, {useState, useEffect} from 'react';

import Auth ,{LM} from '../provider/Auth'

import C from 'rn-class'
import Net from '../provider/Net'
import AsyncStorage from '@react-native-community/async-storage';

 
C.addColor("#03cf5d", "color-naver");


export default (props)=>{

    const [userInfo, setUserInfo] = useState(null);
    useEffect(()=>{
        // LM.logout();   
    }, [])
    let onlogin = async (loginInfo, bfirst )=>{
        // console.log(loginInfo)
        await Net.login(loginInfo) 
        let bTerms = JSON.parse(await AsyncStorage.getItem("@terms"))

        if(bfirst || !bTerms){   
          props.navigation.navigate('AcceptTerms');
        }else{   
          props.navigation.navigate('Root'); 
        // props.navigation.navigate('AccountInfo');    
        } 
    }
    return (
        <C.View cls="jc-sa ai-c flx1 bgc-color-white"> 
            <C.ImageBackground source={require("../res/speech_bubble.png")} 
                cls="ai-c jc-c flx0.5 w70"  
                resizeMode="contain"  
                >   
                <C.Text cls="f5"> empty </C.Text> 
            </C.ImageBackground>
            <C.View>
                <C.Text cls="f2.5 ta-c" > 
                    {"Breathe in slowly \nAre you ready?"}
                </C.Text>
            </C.View>
            <C.View  cls="jc-sa flx0.3 w80%">
                <Auth onLogin={onlogin}/>
            </C.View>
        </C.View>
    )


}

