我正在努力在React Native中创建一个拨号器。为了拨打电话,我使用的是expo-linking,但它只打开了默认的电话拨号程序。在这里搜索后,我找到了关于react-native-immediate-phone-call的信息,并尝试了一下,但没有得到任何结果。我通过npm安装了它,从世博会上弹出的项目在一个虚拟手机上运行了这个应用程序,但当我按下拨号按钮后,我收到了一个警报(所以我现在功能正常了),但没有拨号开始。
<Pressable onPress={this.pressButton}>
<FontAwesomeIcon icon={faPhone} color={colorName} size={35} />
</Pressable>
pressButton = () => {
this.setState({
callValue: (call = !call)
})
Alert.alert(number)
RNImmediatePhoneCall.immediatePhoneCall(number);
}有人能告诉我为什么这个不起作用吗?谢谢。
发布于 2020-10-19 17:18:47
检查您的电话呼叫权限:在android studio项目的AndroidManifest.xml文件中添加:
<uses-permission android:name="android.permission.CALL_PHONE" />https://stackoverflow.com/questions/64424277
复制相似问题