Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-native-contacts returns undefined

I'm tryna get the contacts list of the device but react-native-contacts returns undefined.

enter image description here

I've Installed the package and linked it as mentioned in the project's GitHub page https://github.com/rt2zz/react-native-contacts

I've also added the permissions to the android-manifest file. How do I get it works

like image 968
BaHaa Jr. Avatar asked Jan 28 '26 02:01

BaHaa Jr.


1 Answers

This happens mostly because of the linking-step was missing as there are native modules required:

After npm install react-native-contacts (or yarn add) you are required to link the stuff with

react-native link react-native-contacts

Afterwards you need to rebuild your project (react-native run-android or build in Android Studio). Just to "Reload" in Simulator or on Device is not sufficient after linking a native library.

Also some more permissions needs to be placed in AndroidManifest.xml:

<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
like image 122
itinance Avatar answered Jan 29 '26 16:01

itinance



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!