import React,{Component} from 'react'; import PropTypes from 'prop-types'; import {StyleSheet, View,StatusBar,Image ,Text,Dimensions,AsyncStorage} from 'react-native'; import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view' import {Button} from 'antd-mobile-rn'; import commonStyle from '../../styles/styles.js'; import LoginInput from '../../components/LoginInput'; import Leancloud from '../../leancloud' const {width,height} = Dimensions.get('window'); class LoginScreen extends Component{ static navigationOptions = {title: '登录',header:null} async componentWillMount(){ let user = JSON.parse(await AsyncStorage.getItem('USERINFO')) if(user) { this.setState({ telphone:user.telphone, password:user.password },()=>{ this.submit() }) } } constructor(props){ super(props) this.state={ telphone:"", password:"" } } submit(){ const {navigation} = this.props const {telphone,password} = this.state Leancloud.login(telphone,password,navigation) } render(){ const {telphone,password} = this.state return ( 登录 { this.setState({ telphone }) }} text={telphone} > { this.setState({ password }) }} text={password} > ) } } const styles = StyleSheet.create({ bgView:{ width, flex:1, height:667, }, bgViewImage:{ width, height:667, }, form:{ width:325, height:330, left:24-(375-width)/2, top:217, position:'absolute', padding:26, alignItems:'center' }, btn:{ width:280, height:40, borderRadius:20, marginTop:40 } }); export default (LoginScreen);