Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import { View, Text, StyleSheet, StatusBar, Image, AsyncStorage, ActivityIndicator } from 'react-native';
  3. import { Form, Item, Input, Label, Button } from 'native-base';
  4. import Axios from 'axios';
  5. import CONFIG from '../config/config';
  6.  
  7. export default class LoginScreen extends Component {
  8. constructor(props) {
  9. super(props)
  10. this.state = { _email: '', _pass: '' }
  11. }
  12.  
  13. static navigationOptions = {
  14. drawerLabel: () => null,
  15. drawerLockMode: 'locked-open'
  16. }
  17.  
  18. Logar = async () => {
  19. this.setState({ isLoading: true })
  20. }
  21.  
  22. render() {
  23. return (
  24. <View style={styles.container}>
  25. {
  26. this.state.isLoading &&
  27. <View style={{ flex: 2, alignContent: "center", justifyContent: "center", position: "absolute", top: "30%" }}>
  28. <ActivityIndicator size="large" color="#0000ff" />
  29. </View>
  30. }
  31. <StatusBar hidden />
  32. <View style={styles.headerText}>
  33. <Image source={require('../../assets/logo.png')} style={{ width: 199, height: 70, marginTop: 10 }} />
  34. </View>
  35. <View style={styles.formLogin}>
  36. <Form>
  37. <Item stackedLabel>
  38. <Label>Email</Label>
  39. <Input onChangeText={(email) => this.setState({ _email: email })} />
  40. </Item>
  41. <Item stackedLabel>
  42. <Label>Pass</Label>
  43. <Input onChangeText={(pass) => this.setState({ _pass: pass })} secureTextEntry={true} />
  44. </Item>
  45. <Button block style={styles.buttonLogin} onPress={() => this.Logar()} disabled={this.state.isLoading} isLoading={this.state.isLoading} activeOpacity={0.8} ><Text>ACESSAR</Text></Button>
  46. <Button block light style={{ marginTop: 5, alignContent: 'center', textAlign: 'center' }} onPress={() => this.props.navigation.navigate('Cadastro')}><Text>Criar Conta</Text></Button>
  47. </Form>
  48. </View>
  49. </View>
  50. )
  51. }
  52. }
  53.  
  54. const styles = StyleSheet.create({
  55. container: { flex: 1 },
  56. headerText: { flex: 2, alignItems: 'center', justifyContent: 'center' },
  57. formLogin: { flex: 3 },
  58. buttonLogin: { marginTop: 50 }
  59. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement