import * as React from 'react'; import { TouchableOpacity, Platform, View, Text, Image, Alert, Modal } from 'react-native'; import { Container, FormControl, Stack, Input } from 'native-base'; import { connect } from "react-redux"; import CustomHeader from '../../../components/header.js'; import Assets from '../../../components/assets.manager.js'; import Theme from '../../../components/theme.style.js'; import Elements from '../../../components/elements.js'; import IconX from '../../../components/icons.js'; import REQUEST from '../../../components/api/'; import CustomSafeArea from '../../../components/safeArea.component.js'; const styles = { centeredView: { flex: 1, justifyContent: "center", alignItems: "center", backgroundColor: '#00000090', padding: 30 }, bottomView: { flex: 1, justifyContent: "flex-end", alignItems: "center", backgroundColor: '#00000090', padding: 0 }, modalView: { backgroundColor: '#fff', padding: 20 }, modalTitle: { padding: 5, fontSize: 18, fontWeight: 'bold' }, modalText: { padding: 5, fontSize: 16, color: 'gray', marginTop: 10 } } class ApplyCardDetails extends React.Component { constructor(props) { super(props) this.card = props.route.params || {} } state = { loading: false, modalvisible: false, pin: null, valid: false } componentDidMount() { } componentWillUnmount() { } proceed = () => { this.props.navigation.navigate("AccountEnrollForm", { card_number: this.card.card_number, pin: this.state.pin, callback: this.card.callback, type: this.props.route.params.type }) } onNext = async () => { this.setState({ loading: true }) let body = { card_number: this.card.card_number, pin: parseInt(this.state.pin) } await REQUEST("send_card_pin", "post", {}, {}, body, (res) => { this.setState({ loading: false }) if(res.status == 0) { Platform.OS == 'ios' ? setTimeout(() => { Alert.alert("Error", res.message) }, 300) : Alert.alert("Error", res.message) } else { this.proceed() } }, (error) => { console.log(error) this.setState({ loading: false }) }) } render() { return ( this.props.navigation.goBack()} navigation={this.props.navigation} /> Enter Your Pin Please see the PIN at the back of your card  this.setState({ modalvisible: true })} /> PIN Code this.setState({ pin: val, valid: val.length == 8 ? true : false })} /> this.onNext() } style={{backgroundColor: this.state.valid ? Theme.colors.primary : this.props.app_theme?.theme.dark ? this.props.app_theme?.theme.colors.border : Theme.colors.primary + 15, borderRadius: 5}}> Submit this.setState({ modalvisible: false })} style={{...styles.centeredView, borderRadius: 12}}> ); } } const mapStateToProps = (state) => { return { app_theme: state.appThemeReducer.theme } } export default connect(mapStateToProps, null)(ApplyCardDetails);