zoontek / react-native-permissions

An unified permissions API for React Native on iOS, Android and Windows.
MIT License
4.11k stars 837 forks source link

Cannot read properties of undefined (reading 'iosPermissions') #853

Closed munawarkholil closed 8 months ago

munawarkholil commented 9 months ago

Before submitting a new issue

Bug summary

error on start project

Library version

4.1.4

Environment info

expo-env-info 1.2.0 environment info:
    System:
      OS: macOS 14.3.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 18.17.0 - ~/.nvm/versions/node/v18.17.0/bin/node
      Yarn: 1.22.5 - ~/.yarn/bin/yarn
      npm: 8.9.0 - /opt/homebrew/bin/npm
      Watchman: 2023.12.04.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.12.1 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, visionOS 1.0, watchOS 10.2
    IDEs:
      Xcode: 15.2/15C500b - /usr/bin/xcodebuild
    npmPackages:
      expo: ~50.0.6 => 50.0.8 
      react: 18.2.0 => 18.2.0 
      react-dom: 18.2.0 => 18.2.0 
      react-native: 0.73.4 => 0.73.4 
      react-native-web: ~0.19.6 => 0.19.10 
    npmGlobalPackages:
      eas-cli: 7.3.0
      expo-cli: 6.3.10
    Expo Workflow: managed

Steps to reproduce

error on start project

Reproducible sample code

app.json
"plugins": [
      [
        "react-native-permissions",
        {
          "iosPermissions": [
            "AppTrackingTransparency",
            "Bluetooth",
            "CalendarsWriteOnly",
            "Notifications",
            "SpeechRecognition"
          ]
        }
]

expo sdk 50
Cannot read properties of undefined (reading 'iosPermissions')
edfungus commented 5 months ago

Is this fixed? I don't see any commits/PRs linked to this. Maybe I'm missing something but I'm getting this issue in version 4.1.5, Expo 51, RN 0.74.2

Let me know if I should open a new issue, thanks!

zoontek commented 5 months ago

@edfungus Yes it's fixed. Works perfectly on my side (Expo 51)

nghiadqdev commented 3 months ago

I use "expo": "~51.0.22", "react-native-permissions": "^4.1.5", "react-native": "0.74.3" and i still get this issue, TypeError: Cannot read properties of undefined (reading 'iosPermissions')

Mattefarax commented 2 months ago

Same problem here, any solutions?

gesaleh commented 2 months ago

same problem is it fixed ?

Bad-Science commented 1 month ago

I ran into this as well. My problem was I wasn't wrapping the plugin entry in an array. For example, your plugins list should look like this:

    "plugins": [
      "expo-router",
      "expo-dev-client",
      ["react-native-permissions", {
        "iosPermissions": [
          "Camera",
          "Microphone"
        ]
      }],
      ...
    ],
    ...

Where I was incorrectly doing this:

    "plugins": [
      "expo-router",
      "expo-dev-client",
      "react-native-permissions",
      {
        "iosPermissions": [
          "Camera",
          "Microphone"
        ]
      },
      ...
    ],
    ...

Which caused the same error Cannot read properties of undefined (reading 'iosPermissions'). I haven't tested it actually works but expo does resolve the plugin correctly now.