bndkt / react-native-app-clip

Easily add an App Clip for iOS apps built with React Native
https://bndkt.com/blog/2022/react-native-app-clip
482 stars 22 forks source link

Cannot destructure property 'name' of 'undefined' as it is undefined. #15

Closed techhowdy closed 1 year ago

techhowdy commented 1 year ago

I keep getting this error. I followed all the instructions as per your video. But I don't know how to solve this. Can you share that sample project so I can compare to see what I am missing.

Neiso commented 1 year ago

Same here. Here is the reproduction step:

npx create-expo-app appclip-poc
expo run:ios
# success building
npx expo install react-native-app-clip
# add     "plugins":  ["react-native-app-clip", {}] to app.json
expo run:ios

/project/appclip-poc/node_modules/react-native-app-clip/plugin/build/index.js:9
const withAppClip = (config, { name, groupIdentifier, deploymentTarget = "14.0", requestEphemeralUserNotification, requestLocationConfirmation, appleSignin = true, excludedPackages, expoRouterAppRoot, }) => {
                               ^

TypeError: Cannot destructure property 'name' of 'undefined' as it is undefined.
    at withAppClip (/Users/douatla/project/appclip-poc/node_modules/react-native-app-clip/plugin/build/index.js:9:32)

Package.json:

    "expo": "~48.0.15",
    "expo-splash-screen": "~0.18.2",
    "expo-status-bar": "~1.4.4",
    "react": "18.2.0",
    "react-native": "0.71.7",
    "react-native-app-clip": "^0.1.2"
Neiso commented 1 year ago

Ok obvious typo, expo couldnt read the plugin's parameters. Change your app.json from:

  "plugins": ["react-native-app-clip", { "name": "My App Clip" }]

to

    "plugins": [
      [
        "react-native-app-clip",
        {
          "name": "Hello World"
        }
      ]
    ]