0

Im trying to using stripe-react-native (with expo and using android) library but immediately I use the StripeProvider I got this error (I followed the Docs):

TypeError: null is not an object (evaluating '_NativeStripeSdk["default"].initialise')

This error is located at:
    in StripeProvider (at App.js:35)
    in EnsureSingleNavigator (at BaseNavigationContainer.tsx:409)
    in ForwardRef(BaseNavigationContainer) (at NavigationContainer.tsx:91)
    in ThemeProvider (at NavigationContainer.tsx:90)
...

This is where I use it:

...
import { StripeProvider } from '@stripe/stripe-react-native'
//pass the ref to your navigation container

import { PersistGate } from 'redux-persist/integration/react'
import { store, persistor } from './store'

import { Provider } from 'react-redux'

import { AppTab } from './Navigation'

export default function App() {


  return (
    <Provider store={store}>
      <PersistGate loading={null} persistor={persistor}>
        <NavigationContainer>
          <StripeProvider
            publishableKey="pk_live_L4zEu37Als6Z..."
           
          >
            <AppTab />
          </StripeProvider>
        </NavigationContainer>
      </PersistGate>
    </Provider>
  )
}

my package.json:

...
 "expo": "~41.0.1",
    "expo-status-bar": "~1.0.4",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz",
    "react-native-web": "~0.13.12",
   ...
    "@stripe/stripe-react-native": "^0.1.2",
  ....

I dont find anything on this problem can someone help me seeing what im doing wrong? thanks!

Wiidialga18
  • 331
  • 1
  • 8

2 Answers2

0

You'll need to update your Expo client, support for stripe-react-native was only added recently: https://github.com/stripe/stripe-react-native/issues/3#issuecomment-846225534

Paul Asjes
  • 5,361
  • 1
  • 18
  • 20
  • I finished now to upgrade Expo Client SDK to v.41, I saw that for someone was actually the solution but for me it still appearing: null is not a object (evaluating....), my Package.json: "expo": "~41.0.1", "expo-status-bar": "~1.0.4", "react": "16.13.1", "react-dom": "16.13.1", "react-native": "https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz", – Wiidialga18 May 27 '21 at 10:20
0

As I don't have enough reputation to comment, I'll have to post this as an answer. Extending Paul's solution, it's also helpful to checkout the "Upgrading your app" section of the Expo SDK 41 release blog post: https://blog.expo.io/expo-sdk-41-12cc5232f2ef#e10c.

Some key things to remember are that you will also need to upgrade the Expo apps on the devices you are using. If they are physical then use their respective app stores, and if not then you can can delete the apps and recreate them, or run expo client:install:ios and expo client:install:android. A final piece that helped me was to do a clean run after the upgrade: expo start -c.