nitish24p / react-native-upi

A tiny module for Adding payments via UPI in your react native apps ❤️
MIT License
77 stars 30 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 2 years ago

It seems there is no working solution for iOS.

nitish24p commented 2 years ago

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

Bhav2307 commented 2 years ago

same issue.

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

Please Help...

nitish24p commented 2 years ago

Please check if the module has been linked properly.

rakeshlookings commented 2 years 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 1 year ago

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

nitish24p commented 1 year ago

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