首先,你需要在React Native组件中导入Linking模块。 javascript import { Linking } from 'react-native'; 创建一个函数用于处理拨打电话的逻辑: 接下来,创建一个函数,该函数将使用Linking库的openURL方法来拨打电话。 javascript const handleCall = async (phoneNumber) => { const phoneUrl = `tel:${phon...
import{NativeModules}from'react-native';const{IntentLauncherModule}=NativeModules;constphoneNumber='1234567890';// 设置要拨打的电话号码// 调用Android的电话服务拨打电话IntentLauncherModule.startActivityForResult('android.intent.action.CALL',{data:'tel:'+phoneNumber},(resultCode)=>{// 拨打电话结果回调i...
from 'react-native-immediate-phone-call'; ... RNImmediatePhoneCall.immediatePhoneCall('0123456789'...
for React Native < 0.47 use react-native-immediate-phone-call <1.x.x for React Native 0.47 - 0.59 use react-native-immediate-phone-call >=1.x.x for React Native >= 0.60 use react-native-immediate-phone-call >=2.x.x Setup (NOTICE THAT INSTALLATION STEPS FOR NEWER REACT NATIVE VERSIONS...
如果您查看 react-native-phone-call 的源代码,它最终只是一个包装器: import {Linking} from 'react-native' Linking.openURL(`tel:${phoneNumber}`) 原文由 Tim 发布,翻译遵循 CC BY-SA 4.0 许可协议 有用 回复 撰写回答 你尚未登录,登录后可以 和开发者交流问题的细节 关注并接收问题和回答的更新提醒...
如果您查看 react-native-phone-call 的源代码,它最终只是一个包装器: import {Linking} from 'react-native' Linking.openURL(`tel:${phoneNumber}`) 原文由 Tim 发布,翻译遵循 CC BY-SA 4.0 许可协议 有用 回复 查看全部 1 个回答 推荐问题 为什么 expo 的 react native 项目的文件名会有 ( _ + 这...
import Communicationsfrom'react-native-communications'; render() {return(<View style={styles.container}> <TouchableOpacity style={{height:40,marginTop:40}} onPress={()=>{ Communications.phonecall('10086',false); }}> <Text>调用系统打电话功能</Text> ...
npm install react-native-phone-callWith yarn:yarn add react-native-phone-callUsageTo use the module, call the function with an object containing the number to call as a argument.import call from 'react-native-phone-call' const args = { number: '9093900003', // String value with the ...
// Make a call call(args).catch(console.error); }; In this example of making a Call from React Native App, we will open the contact number on a click of a button in the dialer to call directly using acall(args)provided byreact-native-phone-call. So let’s get started. ...
React Native 使用框架: React 复现步骤 Taro.makePhoneCall 期望结果 调起电话 实际结果 Do not support the makePhoneCall Api 环境信息 👽 Taro v3.5.0-beta.0 Taro CLI 3.5.0-beta.0 environment info: System: OS: macOS 12.0.1 Shell: 5.8 - /bin/zsh Binaries: Node: 16.10.0 - /usr/local/...