Closed rgovindji closed 8 years ago
Did you install the npm package and follow the rest of the installation instructions?
I did the following:
I will try to remove my node_modules and perform an npm install. Sometimes that fixes things. Here's what my project structure looks like after adding RNUnifiedContacts.
Hmm... that should be all that you need to do.
Also try to start the RN server with npm start -- --reset-cache
. That sometimes helps.
I am having the same issue, Contacts is showing up as undefined. Does an explicit library reference need to be added or something?
Solution - The RNUnifiedContacts folder needs to be added under the core Project folder (in RgoVindji's case the Bunch folder)
@antonellil Interesting, I don't have mine added there. It's just at the project root. But, you're saying doing that worked for you?
Yes that worked for me
@antonellil Okay, great. Thanks for sharing.
I get undefined is not an object (evaluating Contacts.getContacts)
@iraycd What does your import statement look like? And what does your XCode project structure look like?
import React, { Component } from 'react';
import NavigationBar from 'react-native-navbar';
import {
StyleSheet,
Text,
View
} from 'react-native';
var Contacts = require('react-native-unified-contacts');
Contacts.getContacts( (error, contacts) => {
if (error) {
console.error(error);
}
else {
console.log(contacts);
}
});
Can you try dragging RNUnifiedContacts
to be "under" the "top-level" DoGroups
. For example, this is how I have it in my Project for ntwrk:
Also, make sure you restart the npm server.
So, the error was more of Swift error and iOS 9.0 Error. But, this was after the changes after following your steps.
rm -Rf ios/build
So, sent a new pull request.
I added the RNUnifiedContacts folder to the root of my project as described in the instructions but when I try to do var Contacts = require('react-native-unified-contacts'); I get an undefined object. Do I need to do anything else aside from adding the folder? Also could you add rnpm integration to make this process easier?