123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import React from "react";
- import { StyleSheet, View, Text, Button } from 'react-native';
- import { globalStyles } from "../styles/global";
- import SmoothPinCodeInput from 'react-native-smooth-pincode-input';
-
- const pin = 123456;
-
- //comentario
-
- export default class App extends React.Component {
-
- pressHandler = () => {
- {/*Dentro del parentesis va el path al screen para redirigir*/}
- this.props.navigation.navigate('test')
- }
-
- state = {
- code: '',
- pincode: false,
- };
- pinInput = React.createRef();
-
- _checkCode = (code) => {
- if (code != pin) {
- this.pinInput.current.shake()
- .then(() => this.setState({ code: '' }));
- } else {
- this.setState({ pincode: true});
- }
- }
-
- render() {
- const { code } = this.state;
- const { pincode } = this.state;
- return (
- <View style={globalStyles.container}>
- {/* Pin container */}
- <View style={globalStyles.section}>
- <Text style={globalStyles.titleText}>Entra el Pin de la mocion</Text>
- <SmoothPinCodeInput
- ref={this.pinInput}
- value={code}
- codeLength={6}
- onTextChange={code => this.setState({ code })}
- onFulfill={this._checkCode}
- onBackspace={() => console.log('No more back.')}
- />
- </View>
-
- <View style={globalStyles.container}>
- { pincode && <Button title='Ir a mocion' onPress={this.pressHandler} />}
- </View>
-
- </View>
- );
- }
- }
-
-
-
|