加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

React Native Android 组件IntentAndroid 实现拨打电话

发布时间:2020-12-15 04:44:02 所属栏目:百科 来源:网络整理
导读:React Native Android 组件IntentAndroid 实现拨打电话 在 render 中添加 TouchableHighlight onPress = { () = this.selectTopic() } Text style = {styles.instructions} 拨打电话 : 13696891111 / Text TouchableHighlight 添加点击控件绑定 具体的也不知

React Native Android 组件IntentAndroid 实现拨打电话

在 render 中添加

<TouchableHighlight  onPress={ () => this.selectTopic()
                  }>
        <Text style={styles.instructions}>
         拨打电话 : 13696891111
        </Text>

TouchableHighlight 添加点击控件绑定 具体的也不知道啦

添加实现方法selectTopic

selectTopic :function(){
var url='tel: 13696891111';
// 判断 手机是否支持 url  
 IntentAndroid.canOpenURL(url,(supported) => {
  if (!supported) {
  ToastAndroid.show('不能打开地址'+url,ToastAndroid.SHORT);
  } else {
    IntentAndroid.openURL(url);
  }
});
},

tel : + 号码 拨打电话
url 打开网页

参考资料 http://react-native.cn/docs/linkingios.html#content IntentAndroid 的api 还没出来 感谢 天地之灵 提供资料

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读