nitish24p / react-native-upi

A tiny module for Adding payments via UPI in your react native apps ❤️
MIT License
72 stars 29 forks source link

null is not an object (evaluating 'UpiModule.intializePayment') #38

Open amitleuva1987 opened 2 years ago

amitleuva1987 commented 2 years ago

when I run my 'react native' project in 'expo go' app, I receive below error.

null is not an object (evaluating 'UpiModule.intializePayment'). below is the code.

 import React, {useState} from 'react';
 import { SafeAreaView, Text, View, Button, TextInput, StyleSheet } from 'react-native';
 import RNUpiPayment from 'react-native-upi-payment';

function Checkout(){
const text = 'Please enter a value';
const [status, setStatus] = useState('');
function initialize(){
    RNUpiPayment.initializePayment({
        vpa: '9033049648@ybl', // or can be john@ybl or mobileNo@upi
        payeeName: 'Amit Leuva',
        amount: '1',
        transactionRef: '123'
    },successCallback,failureCallback);
}

function successCallback(data){
    setStatus(status='success');
}
function failureCallback(data){
    setStatus(status='success');
}
return(
    <SafeAreaView>
    <View>
        <Button title='Pay now' onPress={() => initialize()} />
    </View>
    </SafeAreaView>
 );
}

export default Checkout;

Do you have alternate way to make this package work with my project?

tejasvi commented 1 year ago

It seems there is no working solution for iOS.

nitish24p commented 1 year ago

Yes this is only for android. Also if expo doesnt provide native modules support for now this wont work.

Bhav2307 commented 1 year ago

same issue.

TypeError: null is not an object (evaluating 'UpiModule.intializePayment');

Please Help...

nitish24p commented 1 year ago

Please check if the module has been linked properly.

rakeshlookings commented 1 year ago

Do not use expo because it lacks native module support

Rahul6694 commented 1 year ago

TypeError: null is not an object (evaluating 'UpiModule.intializePayment'

Karthikpkapture commented 8 months ago

Facing the same issue on react native expo "TypeError: Cannot read property 'intializePayment' of null "

nitish24p commented 8 months ago

Not sure if this will work with expo, can you console.log the UpiModule value