1.1.3 • Published 8 years ago
react-native-contacts-android v1.1.3
react-native-contacts-android
receiving contact from the phonebook
Install
- npm install react-native-contacts-android --save
- In
android/setting.gradle
...
include ':react-native-contacts-android'
project(':react-native-contacts-android').projectDir = new File(settingsDir, '../node_modules/react-native-contacts-android')
- In
android/app/build.gradle
...
dependencies {
...
compile project(':react-native-contacts-android')
}
- register module (in android/app/src/main/java/your-app-namespace/MainActivity.java)
import ru.getintime.react_native_contacts_android.ReactNativeSelectContactsPackage; // <------ add import
public class MainApplication extends Application implements ReactApplication {
@Override
protected List<ReactPackage> getPackages() {
......
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
......
new ReactNativeSelectContactsPackage()
);
}
}
- add Contacts permission (in android/app/src/main/AndroidManifest.xml)
...
<uses-permission android:name="android.permission.READ_CONTACTS" />
...
Usage Example
import SelectContacts from 'react-native-contacts-android';
SelectContacts.picker((contact) => {
...
})
Contact
{
"id": "2",
"phones": [
"id": "50",
"number": "12344234"
]
}