调用系统的打电话,发短信,系统浏览器,发送邮件的功能

来源:互联网 发布:matlab asm算法 编辑:程序博客网 时间:2024/05/17 03:23

导入linking库 然后在调用的方法里面+

renderSystem = (url)=> {
        Linking.canOpenURL(url).then(supported=> {
                      if (!supported) {
                        console.log('Can\'t handle url: ' +url);
                      } else {
                        returnLinking.openURL(url);
                      }
                    }).catch(err=>console.error('An error occurred',err));
      }

在使用时传入有用信息

例如

onPress = {this.renderSystem.bind(this,'tel:'+phone)}
{/*系统打电话功能传'tel:18585025253'
                        系统发送邮件功能传'mailto:674668211@qq.com'
系统打开http网页功能传'http://www.baidu.com'
                        系统发送短信功能传'smsto:18585025253'*/}
到此就可以简单的使用系统内部的一些功能。

自己摸索,如果不对,谢谢大家前来留言指导。

阅读全文
0 0
原创粉丝点击