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

Paystack ref uses initial state values #57

Closed
kazeemOnis opened this issue Apr 5, 2021 · 3 comments
Closed

Paystack ref uses initial state values #57

kazeemOnis opened this issue Apr 5, 2021 · 3 comments

Comments

@kazeemOnis
Copy link

kazeemOnis commented Apr 5, 2021

I'm fetching my amount and apikey from an API, but for some reason, the paystack ref uses the initial values of the states

const [paystackKey, setPaystackKey] = useState('');
const [amount, setAmount] = useState(0);
const paystackWebViewRef = useRef();

useEffect(() => {
setAmount(100000);
setPaystackKey('ps...........');
}, []);


<PaystackWebView
    showPayButton={false}
    paystackKey={paystackKey}
    amount={amount}
    billingEmail={user.email}
    billingMobile={user.telephone}
    billingName={user.firstName}
    ActivityIndicatorColor="green"
    refNumber={Math.floor((Math.random() * 1000000000) + 1)}
    ref={paystackWebViewRef}
    onSuccess={(tranRef: any) => { confirmPayment(tranRef); }}
    onCancel={() => { console.log('something went wrong'); }}
/>

So on payment, the paystack key would empty and the amount still zero. Any help will be useful @just1and0 .

@mosoakinyemi
Copy link
Collaborator

Looking into this

@kazeemOnis
Copy link
Author

@mosoakinyemi thanks, please if you need anything from me let me know.

@mosoakinyemi
Copy link
Collaborator

mosoakinyemi commented Jun 26, 2021

Hey bro, I tried recreating this and had no issue at all.
https://snack.expo.io/@mosoakinyemi/rn-paystack-webview-issue-57

Kindly crosscheck your app logic 🙂.
Cheers!

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

3 participants