stripe / stripe-react-native

React Native library for Stripe.
https://stripe.dev/stripe-react-native
MIT License
1.26k stars 262 forks source link

TypeError: null is not an object (evaluating '_NativeStripeSdk.default.getConstants') #1194

Closed staifn closed 1 year ago

staifn commented 1 year ago

Describe the bug I have this error when a build my project on ios simulator: TypeError: null is not an object (evaluating '_NativeStripeSdk.default.getConstants')

I tried to setup stripe-react-native on a new react-native project and it works without problem but not on mine.

Expected behavior To build without crashing

Screenshots

image

Smartphone (Simulator):

Additional context App.ts:

const App = () => {
  return (
    <StripeProvider
      publishableKey={STRIPE_PUBLISHABLE_KEY}
      urlScheme={STRIPE_URL_SCHEME} // required for 3D Secure and bank redirects
    >
      <Text>test</Text>
    </StripeProvider>
  );
};

package.json:

{
  "name": "my project name",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "npx react-native run-android",
    "ios": "npx react-native run-ios",
    "start:native": "npx react-native start",
    "test": "jest",
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
    "web": "next",
    "build:web": "next build",
    "start:web": "next start"
  },
  "dependencies": {
    "@emotion/react": "^11.9.3",
    "@emotion/styled": "^11.9.3",
    "@mui/icons-material": "^5.8.4",
    "@mui/material": "^5.9.1",
    "@react-native-async-storage/async-storage": "^1.17.10",
    "@react-native-community/slider": "^4.2.4",
    "@react-navigation/bottom-tabs": "^6.3.2",
    "@react-navigation/native": "^6.0.11",
    "@react-navigation/native-stack": "^6.7.0",
    "@react-navigation/stack": "^6.2.2",
    "@stripe/stripe-react-native": "^0.20.0",
    "firebase": "^8.3.1",
    "graphql": "^15.5.0",
    "graphql-request": "^3.4.0",
    "i18next": "^21.8.14",
    "js-cookie": "^3.0.1",
    "moment": "^2.29.4",
    "next": "latest",
    "next-i18next": "^11.1.1",
    "next-transpile-modules": "^9.0.0",
    "react": "18.1.0",
    "react-dom": "^18.2.0",
    "react-i18next": "^11.18.1",
    "react-native": "0.70.4",
    "react-native-dotenv": "^3.3.1",
    "react-native-gesture-handler": "^2.5.0",
    "react-native-gifted-chat": "^1.0.3",
    "react-native-image-slider-box": "^2.0.2",
    "react-native-modal": "^13.0.1",
    "react-native-safe-area-context": "^4.3.1",
    "react-native-screens": "^3.15.0",
    "react-native-swipe-gestures": "^1.0.5",
    "react-native-track-player": "^3.2.0",
    "react-native-vector-icons": "^9.2.0",
    "react-native-video": "^5.2.1",
    "react-native-web": "0.17.1",
    "react-navigation": "^4.4.4",
    "react-navigation-stack": "^2.10.4",
    "react-player": "^2.10.1",
    "react-responsive": "^9.0.0-beta.10",
    "react-slick": "^0.29.0",
    "slick-carousel": "^1.8.1",
    "socket.io-client": "^4.5.1",
    "styled-components": "^5.3.5"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "@testing-library/react-native": "^11.0.0",
    "@tsconfig/react-native": "^2.0.0",
    "@types/jest": "^28.1.7",
    "@types/js-cookie": "^3.0.2",
    "@types/react-native": "^0.69.1",
    "@types/react-native-vector-icons": "^6.4.11",
    "@types/react-native-video": "^5.0.14",
    "@types/react-slick": "^0.23.10",
    "@types/react-test-renderer": "^18.0.0",
    "@types/styled-components": "^5.1.25",
    "@types/styled-components-react-native": "^5.1.3",
    "@typescript-eslint/eslint-plugin": "^5.29.0",
    "@typescript-eslint/parser": "^5.29.0",
    "babel-jest": "^26.6.3",
    "babel-plugin-react-native-web": "^0.18.4",
    "babel-plugin-styled-components": "^2.0.7",
    "eslint": "^7.32.0",
    "jest": "^28.1.3",
    "metro-react-native-babel-preset": "0.72.3",
    "react-test-renderer": "18.1.0",
    "ts-jest": "^28.0.8",
    "typescript": "^4.4.4"
  },
  "resolutions": {
    "@types/react": "^18"
  },
  "jest": {
    "preset": "react-native",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "jsx",
      "json",
      "node"
    ]
  }
}
staifn commented 1 year ago

I don't how but my problem has gone.

gaurav27ats commented 1 year ago

i am getting the same issue, and i was not getting any solution , please help me to resolve this issue

"@stripe/stripe-react-native": "^0.23.0",
 "react": "^16.0.0",
 "react-native": "^0.65.1",
AhmadAl-Ghalban commented 1 year ago

if Solve Issue ???