![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@pru-rt/react-native-contacts-wrapper
Advanced tools
A fork of the original package with more fields (on iOS)
This is a fork The original package had too few contact information. This package was only tested on iOS!.
Install
yarn add prudential/react-native-contacts-wrapper
![alt tag](https://github.com/LynxITDigital/Screenshots/blob/master/RN%20Contacts%20Wrapper%20example.gif)
This is a simple wrapper for the native iOS and Android Contact Picker UIs. When calling the API functions, the appropriate picker is launched. If a contact is picked, the promise is resolved with the requested data about the picked contact.
This uses the ContactsContract API for Android, AddressBook library for iOS8 and below and the new Contacts library for ios9+.
The API is currently very basic. This was started just as a way of selecting a contact's email address. The getContact function was added as a more generic way of returning contact data. Currently this returns Name, Phone and Email for picked contact. In future more fields will be added to this, and possibly more specific methods similar to getEmail.
Feel free to extend the functionality so it's more useful for everyone - all PRs welcome!
## Installation
### Automatic (works for iOS without condition; for Android with RN 0.28 and before)
If you have rnpm installed, all you need to do is
```
npm install react-native-contacts-wrapper --save
rnpm link react-native-contacts-wrapper
```
### Manual
#### Android (with RN 0.29 and above)
in `settings.gradle`
```
include ':react-native-contacts-wrapper'
project(':react-native-contacts-wrapper').projectDir = new File(settingsDir, '../node_modules/react-native-contacts-wrapper/android/app')
```
in `android/app/build.gradle`
```
dependencies {
compile project(':react-native-contacts-wrapper')
```
in `MainApplication.java`
add package to getPacakges()
```
import com.lynxit.contactswrapper.ContactsWrapperPackage;
...
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
...,
new ContactsWrapperPackage()
);
}
```
in `AndroidManifest.xml`
make sure you have the following setting even if you have done `react-native upgrade`
```
<application
android:name=".MainApplication"
```
#### iOS
1. Open your xCode project
2. Click project name in project navigator
3. Select the main target in the left hand menu
4. Scroll to Linked Frameworks and Libraries
5. click + at bottom
6. Click ‘Add Other'
7. Find and add your new project’s .xcodeproj file from node_modules
8. This will now appear in project explorer, drag in under the Libraries group.
9. In same screen, click + again, you should now see the .a file for you project, Add this
10. Clean and Rebuild your Xcode project
##API
`getContact` (Promise) - returns basic contact data as a JS object. Currently returns name, first phone number and first email for contact.
`getEmail` (Promise) - returns first email address (if found) for contact as string.
##Usage
Methods should be called from React Native as any other promise.
Prevent methods from being called multiple times (on Android).
###Example
An example project can be found in this repo: https://github.com/LynxITDigital/react-native-contacts-wrapper-example/tree/master
```
import ContactsWrapper from 'react-native-contacts-wrapper';
...
if (!this.importingContactInfo) {
this.importingContactInfo = true;
ContactsWrapper.getEmail()
.then((email) => {
this.importingContactInfo = false;
console.log("email is", email);
})
.catch((error) => {
this.importingContactInfo = false;
console.log("ERROR CODE: ", error.code);
console.log("ERROR MESSAGE: ", error.message);
});
```
FAQs
A fork of the original package with more fields (on iOS)
The npm package @pru-rt/react-native-contacts-wrapper receives a total of 1 weekly downloads. As such, @pru-rt/react-native-contacts-wrapper popularity was classified as not popular.
We found that @pru-rt/react-native-contacts-wrapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.