#jesuisilya
1 messages · Page 1 of 1 (latest)
Hiya, just tidied it up for you, here it is
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { View } from 'react-native';
import { connect } from 'react-redux';
import { createStructuredSelector } from 'reselect';
import { PlatformPayButton, usePlatformPay } from '@stripe/stripe-react-native';
import {
addStripeAccount,
generateStripePaymentIntentDetails,
} from '../../resources/user/user.actions';
import {
selectStripePaymentIntent,
selectUserProfile,
} from '../../resources/user/user.selectors';
import Log from '../../../log.config';
const ApplePay = ({ navigation, route, setLoading, ...props }) => {
const [isApplePaySupported, setIsApplePaySupported] = useState(false);
const { isPlatformPaySupported } = usePlatformPay();
useEffect(() => {
if (isApplePaySupported) {
const isSupported = isApplePaySupported;
Log.debug('Is Apple Pay Supported?', isSupported);
}
}, [isApplePaySupported]);
useEffect(() => {
(async function () {
setIsApplePaySupported(await isPlatformPaySupported());
})();
}, [isPlatformPaySupported]);
return (
<View>
{ isApplePaySupported && (
<PlatformPayButton
type="standard"
onPress={() => {
}}
style={{
height: 40,
marginHorizontal: 20,
}}
/>
)}
</View>
);
};
Hi! I'm taking over my colleague. Please, give me a moment to catch up.
What version of stripe-react-native are you using?
To be fair, I've updated the library just this morning, so this function might not be showing up because I need to rebuild the app
The version is 0.26.0
Could you try this please?
Yeah, if the problem persists can I just come back to the same thread or do I need to start a new one?
Also, you might not need to use the react hook, and just import the method from '@stripe/stripe-react-native'
I will be around for some time, but if you find this thread is closed, feel free to open a new one, my colleagues will jump in to help.