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

[Expo] NativeStripeSdk in StripeProvider.tsx is undefined using initStripe #249

Closed
ghost opened this issue May 20, 2021 · 3 comments
Closed
Labels
question Further information is requested

Comments

@ghost
Copy link

ghost commented May 20, 2021

Describe the bug

initStripe({
  publishableKey: 'pk_test_xxx',
}).then(r => console.log(r)).catch(e => console.error(e));

Using the preceding code to initialize stripe in a componentDidMount in an expo project causes a:

TypeError: Cannot read property 'initialise' of undefined (StripeProvider.tsx:42) error.

To Reproduce

import { initStripe } from '@stripe/stripe-react-native';

class App extends Component {
  state = {};

  componentDidMount = () => {
  
    initStripe({
      publishableKey: 'pk_test_xxx',
    }).then(r => console.log(r)).catch(e => console.error(e));
  };

  // render() {...}
}

Expected behavior
NativeStripeSdk to be compiled and working in the package import.

Desktop (please complete the following information):

  • OS: Ubuntu desktop
  • Browser [e.g. chrome, safari]
  • Version: 20.04

Smartphone (please complete the following information):

  • Device: Android emulator
  • OS: Android Pixel 4 API level 30

stripe-react-native version:
0.1.1

@thorsten-stripe
Copy link
Contributor

thorsten-stripe commented May 20, 2021

How are you running your expo project? Expo support is still quite limited, see https://github.com/stripe/stripe-react-native#expo

We're working with the Expo team to make this smoother, you can follow along here: #3 cc @cruzach

@thorsten-stripe thorsten-stripe added the question Further information is requested label May 20, 2021
@thorsten-stripe thorsten-stripe changed the title NativeStripeSdk in StripeProvider.tsx is undefined using initStripe [Expo] NativeStripeSdk in StripeProvider.tsx is undefined using initStripe May 20, 2021
@ghost
Copy link
Author

ghost commented May 20, 2021

How are you running your expo project? Expo support is still quite limited, see https://github.com/stripe/stripe-react-native#expo

We're working with the Expo team to make this smoother, you can follow along here: #3

Hi @thorsten-stripe! I'm running the project as a "managed workflow". Like you said the expo support does still seem quite limited. I'll maybe try my chances to eject the project to a bare workflow instead. Generally I'd like to avoid it since there would be no other reason than getting compatibility with this project. I have already been playing around with options to see if it's caused by babel or anything similar configurable.

@cruzach
Copy link
Collaborator

cruzach commented May 21, 2021

hi @carl-passnfly ! Good news for you- Expo managed workflow support for @stripe/stripe-react-native has landed 😄

If you download the newest versions of Expo Go from the stores, you should be good to go

Refer to these docs for more info - https://docs.expo.io/versions/v41.0.0/sdk/stripe/

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

No branches or pull requests

2 participants