Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native 如何在react本机应用程序中访问联系人列表_React Native - Fatal编程技术网

React native 如何在react本机应用程序中访问联系人列表

React native 如何在react本机应用程序中访问联系人列表,react-native,React Native,我正在开发一个完整的移动CRM,作为开发的一部分,我需要通过电话访问和修改联系人列表 哪一个插件是用于此目的的最佳插件?查看React Native Contacts,发现首先您需要安装React Native Contacts库。运行此命令npm install react native contacts--save 然后使用这个代码 import Contacts from 'react-native-contacts'; Contacts.getAll((err, contacts) =

我正在开发一个完整的移动CRM,作为开发的一部分,我需要通过电话访问和修改联系人列表


哪一个插件是用于此目的的最佳插件?

查看React Native Contacts,发现

首先您需要安装React Native Contacts库。运行此命令
npm install react native contacts--save

然后使用这个代码

import Contacts from 'react-native-contacts';

Contacts.getAll((err, contacts) => {
  if (err) {
    throw err;
  }
 // contacts returned
})

要在
IOS
android
上进行特定访问,请通过此链接

如果您正在使用,则最好使用。我发现它非常容易使用。

现在,他们有了api,可以根据提供的电话号码返回联系人,下面是一个示例

import Contacts from 'react-native-contacts';

  const phoneNumber = "+92123456789"; //Number could be complete and it will search 
                                      //with all the numbers from the contacts 
                                      //database and will return results accordingly. 

  Contacts.getContactsByPhoneNumber(phoneNumber, (err, contacts) => {
    if (err) {
      console.log('some error happended ' + err);
    } else {
      // contact is javascript object and that can have more that one contacts details
      console.log('Contact : ' + JSON.stringify(contacts));
    }
  });
更多详情可从这里获得