#jesuisilya

1 messages · Page 1 of 1 (latest)

maiden vaultBOT
winged grotto
#

👋 happy to help

#

would you mind sharing your code please?

pastel peak
#

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>
  );
};
dusty crown
#

Hi! I'm taking over my colleague. Please, give me a moment to catch up.

#

What version of stripe-react-native are you using?

pastel peak
#

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

pastel peak
#

Yeah, if the problem persists can I just come back to the same thread or do I need to start a new one?

dusty crown
#

Also, you might not need to use the react hook, and just import the method from '@stripe/stripe-react-native'

dusty crown