Please provide the following:
- SDK Version: 35.0.0
- Platforms(Android/iOS/web/all): Android
SNACK - Here I created a Snack that replicates the error: moody turkish delight - Snack
I get this error when calling the function loadContacts()
componentDidMount() {
this.loadContacts()
// console.warn("user in main?", )
}
loadContacts= async()=>{
const permission = await Expo.Permissions.getAsync(
Expo.Permissions.CONTACTS
)
if (permission.status !== 'granted') {
return
}
const {data}= await Contacts.getContactsAsync({
fields: [Contacts.Fields.PhoneNumbers]
})
this.setState({contacs:data})
}
I’m importing my permissions like this
import * as Permissions from 'expo-permissions';
And this is what my package.json looks like
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"expo": "^35.0.0",
"react": "16.8.3",
"react-dom": "16.8.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz",
"react-native-gesture-handler": "~1.3.0",
"react-native-reanimated": "~1.2.0",
"react-native-screens": "~1.0.0-alpha.23",
"react-native-web": "^0.11.7",
"react-navigation": "^4.0.10",
"react-navigation-stack": "^1.10.3"
},
"devDependencies": {
"babel-preset-expo": "^7.1.0"
},
"private": true
}
Also here is my package-lock json
"expo-permissions": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/expo-permissions/-/expo-permissions-7.0.0.tgz",
"integrity": "sha512-C+qyVz+pdZO4YpVR2HSC3gsBZg0Qb8brCFgzmDmWcAtgrOiHClaLPdhI2XtQuGh8ubXcKPUGZp++UCEGiG0Jxg=="
}
But I can’t still not figure out how to solve this error. I’ll appreciate your help.
In case this matters, I tried to install the permissions by running expo install expo-permissions but this gave me back spawn yarnpkg ENOENT so I used instead npm install expo-permissions and this seemed to work fine.