Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. import React from 'react';
  2. import {Alert} from 'react-native'
  3. import { AppLoading } from 'expo';
  4. import { Container, Header, Content, Form, Item, Input, Label, Button, Icon, Text } from 'native-base';
  5. import * as Font from 'expo-font';
  6. import { Ionicons } from '@expo/vector-icons';
  7.  
  8. export default class App extends React.Component {
  9. constructor(props) {
  10. super(props);
  11. this.state = {
  12. isReady: false,
  13. };
  14. this.state = {username: '', password: ''};
  15. }
  16.  
  17. async componentDidMount() {
  18. await Font.loadAsync({
  19. Roboto: require('native-base/Fonts/Roboto.ttf'),
  20. Roboto_medium: require('native-base/Fonts/Roboto_medium.ttf'),
  21. ...Ionicons.font,
  22. });
  23. this.setState({ isReady: true });
  24. }
  25.  
  26.  
  27. Loguearme = () => {
  28.  
  29. if(this.state.username == "wilmerap" && this.state.password == "945637"){
  30. Alert.alert("Usuario y contraseña Correctos");
  31.  
  32. }else{
  33.  
  34. Alert.alert("Datos Incorrectos");
  35.  
  36. }
  37. }
  38.  
  39.  
  40. render() {
  41. if (!this.state.isReady) {
  42. return <AppLoading />;
  43. }
  44. let {username} = this.state
  45. let {password} = this.state
  46. return (
  47. <Container>
  48. <Header />
  49. <Content>
  50. <Form>
  51. <Item floatingLabel>
  52. <Label>Username</Label>
  53. <Input onChangeText={(username) => this.setState({username})}/>
  54. </Item>
  55. <Item floatingLabel last>
  56. <Label>Password</Label>
  57. <Input onChangeText={(password) => this.setState({password})}/>
  58. </Item>
  59.  
  60. <Button rounded success onPress={this.Loguearme} style={{ height: 40, marginTop : 40 }}>
  61. <Icon type="FontAwesome" name="home" style={{ color: '#ED4A6A' }}/>
  62. <Text >Loguearme</Text>
  63. </Button>
  64.  
  65. </Form>
  66. </Content>
  67. </Container>
  68. );
  69. }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement