在本机反应中打开联系人应用程序

2024-03-03

我正在制作一个反应本机应用程序,在一个屏幕上有一个表单,用户必须在其中填写用户必须填写他的手机号码的表单,因此我正在制作一个按钮,该按钮将打开用户手机的联系人应用程序,用户可以从该列表中选择联系人号码,该号码将被填充到该字段中。

我找到了这个链接反应本机接触 https://github.com/rt2zz/react-native-contacts但我认为是这样 获取所有联系人列表并使用列表视图在反应本机应用程序中显示它,但我不想要这种类型的功能。我只想打开联系人应用程序,然后如果用户选择应在手机号码字段中填写的任何特定联系人。

代码实现

import ContactsWrapper from 'react-native-contacts-wrapper';
import { Separator, SeparatorDate } from '../../components/List';

export default class AddNewClub extends Component {


  constructor(props) {

    super(props);
    this.onMobileIconPressed = this.onMobileIconPressed.bind(this);

    this.state = {

      registerButtonClicked: false,


    };

  }

  registerButtonClick = () => {


    this.setState({
      registerButtonClicked: true,

    });

  };


  onMobileIconPressed() {
    ContactsWrapper.getContact()
    .then((contact) => {
        // Replace this code
        console.log(contact);
    })
    .catch((error) => {
        console.log("ERROR CODE: ", error.code);
        console.log("ERROR MESSAGE: ", error.message);
    });
}

这是我编写的代码,当我在设备上测试此屏幕时,它会给出错误“无法解析模块react-native-contacts-wrapper


您可以使用反应本机接触包装 https://github.com/LynxITDigital/react-native-contacts-wrapper

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在本机反应中打开联系人应用程序 的相关文章

随机推荐