Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pay Now Button Component not displaying in Front End #78

Closed
mosesegboh opened this issue Aug 11, 2021 · 15 comments
Closed

Pay Now Button Component not displaying in Front End #78

mosesegboh opened this issue Aug 11, 2021 · 15 comments

Comments

@mosesegboh
Copy link

Hello, installed the library, but I cannot find the "Pay Now" button when I load the component on my app as displayed in the tutorial. Who can help. Is there anything extra I need to do?
Regards.

@just1and0
Copy link
Owner

Hello 👋🏾

pay now button was taken out of V4, I’d advice referring to the docs on the use of Ref to initiate payment with pay now button here

@mosesegboh
Copy link
Author

mosesegboh commented Aug 11, 2021

Hello Tobi,
Thanks for your prompt response. I had already tried using the second approach with useRef, However I get an error with the line of code displayed below:
"const paystackWebViewRef = useRef<paystackProps.PayStackRef>();"
Can't seem to figure out a way around it.
any suggestions why that is?
I have attached a screenshot of my code with the error message below:
Kindly assist if you can.
image

@just1and0
Copy link
Owner

Hello what version are you using ?

@mosesegboh
Copy link
Author

I am using "react-native-paystack-webview": "^4.0.3",

@mosesegboh
Copy link
Author

mosesegboh commented Aug 11, 2021

I also get the error, "Paystack props is not defined" when I pass in "null as a parameter for the useRef code I highlighted above "as displayed in the image below;
image

@just1and0
Copy link
Owner

that's a wrong usage, you're not meant to set null with that ref. make sure your code look very similar to this

import React, {useRef} from 'react';
import type { Node } from 'react';
import {
  SafeAreaView, 
  Text, 
  TouchableOpacity
} from 'react-native';

import { Paystack, paystackProps } from 'react-native-paystack-webview'
 
const App: () => Node = () => {

  const paystackWebViewRef = useRef<paystackProps.PayStackRef>(); 

  console.log(paystackWebViewRef)

  return (
    <SafeAreaView>
      <Paystack
        paystackKey={'your-pk-here'}
        onCancel={() => { }}
        onSuccess={() => { }}
        billingEmail={'your-email-here'}
        billingName={'your-billing-name-here'}
        amount={'700.90'} 
        ref={paystackWebViewRef}
        // autoStart={true}
      />

      <TouchableOpacity onPress={() => paystackWebViewRef.current.startTransaction()}>
        <Text>Pay Now</Text>
      </TouchableOpacity>
    </SafeAreaView>
  );
};
 

export default App;



@mosesegboh
Copy link
Author

Hello,
Thanks for the response.
I tried it as you have stated in the code, however, I am still getting the same error on that same line of code.
I even went as far as disabling javascript validation in my vscode but the code won't compile due to that error.
Below is a screenshot of my code with the error message
image

@just1and0
Copy link
Owner

just1and0 commented Aug 12, 2021

I have tried to replicate this issue but it still works fine for me. Can we hop on a call this morning to see what the issue is, google meet.

Ps: I won’t be available anything after 12:00pm

@mosesegboh
Copy link
Author

Hello Tobi,
Kindly give me time and a link and will definitely be available

@just1and0
Copy link
Owner

What’s your email ?

@mosesegboh
Copy link
Author

mosesegboh@gmail.com

@just1and0
Copy link
Owner

Just sent an invite, we can do 8:30

@mosesegboh
Copy link
Author

ok noted

@mosesegboh
Copy link
Author

Hi Tobi,
I am in

@mosesegboh
Copy link
Author

Hi Tobi,
I have sent you an invite on github.
Looking forward to hearing from you soon.
Thanks once again.
Regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants