import React, {Component} from 'react'; import { StyleSheet, Text, View, FlatList, TouchableOpacity,Image } from 'react-native'; import { Content, Container, Header, Body, Title, Left, Icon, Right, Button as Btn, Card, CardItem, List, ListItem, Thumbnail, Row} from 'native-base'; import * as colors from '../assets/css/Colors'; import back from "../assets/icons/back1.png"; import axios from 'axios'; import { Loader } from '../components/GeneralComponents'; import { wallet_icon, api_url, get_wallet, add_wallet ,font_description,font_title , no_wallet_lottie} from '../config/Constants'; import { Button } from 'react-native-elements'; import DialogInput from 'react-native-dialog-input'; import Moment from 'moment'; import RazorpayCheckout from 'react-native-razorpay'; import LottieView from 'lottie-react-native'; class Wallet extends Component { constructor(props) { super(props) this.handleBackButtonClick = this.handleBackButtonClick.bind(this); this.open_dialog = this.open_dialog.bind(this); this.add_wallet = this.add_wallet.bind(this); this.state = { isDialogVisible:false, wallet:0, wallet_histories:[], isLoding:false, api_status:0 } this.get_wallet(); } get_wallet = async() =>{ // this.setState({ isLoding:true }); // await axios({ // method: "post", // url: api_url + get_wallet, // data: { id : global.id } // }) // .then(async (response) => { // this.setState({ isLoding:false ,api_status:1}); // this.setState({ wallet : response.data.result.wallet, wallet_histories : response.data.result.wallet_histories }) // }) // .catch((error) => { // this.setState({ isLoding:false }); // alert("Something went wrong"); // }); } add_wallet_success = async(amount) =>{ this.setState({ isLoding:true }); await axios({ method: "post", url: api_url + add_wallet, data: { id :'global.id', amount : 67 } }) .then(async (response) => { this.setState({ isLoding:false }); this.get_wallet(); }) .catch((error) => { this.setState({ isLoding:false }); alert("Your transaction declined"); }); } handleBackButtonClick= () => { this.props.navigation.goBack(null); } open_dialog(){ this.setState({ isDialogVisible: true }); } add_wallet(amount){ // if(!isNaN(amount)){ // var options = { // currency: global.currency_short_code, // key: global.razorpay_key, // amount: amount * 100, // name: global.application_name, // prefill: { // email: global.email, // contact: global.phone_number, // name: global.customer_name // }, // theme: {color: colors.theme_fg} // } // RazorpayCheckout.open(options).then((data) => { // this.add_wallet_success(amount); // }).catch((error) => { // alert('Sorry something went wrong'); // }); // }else{ // alert('Please enter valid amount'); // } // this.setState({ isDialogVisible: false }); this.props.navigation.navigate('WalletAdd',{data:amount}) this.setState({ isDialogVisible: false }); } show_alert(message){ } render() { return ( Wallet {global.currency}{this.state.wallet} Your balance