React native React本机链接承诺已解决拒绝未被调用
我正在使用react本机链接组件打开呼叫应用程序。呼叫建议对话框已打开,但当我单击“取消”时,它不会返回任何承诺 静态makePhoneCall=mobileNumber=> { 设phoneNumber=; 如果Platform.OS==='android'{ let userMobile=`tel:${mobileNumber}` 电话号码=用户移动电话; } 否则{ let userMobile=`tel://${mobileNumber}` 电话号码=用户移动电话; } Linking.openURLphoneNumber.then=>{ 警惕“成功” }.catch=>{ 警告“失败” }; 返回默认值` } classname.makePhoneCallthis.state.item.mobileNumberReact native React本机链接承诺已解决拒绝未被调用,react-native,React Native,我正在使用react本机链接组件打开呼叫应用程序。呼叫建议对话框已打开,但当我单击“取消”时,它不会返回任何承诺 静态makePhoneCall=mobileNumber=> { 设phoneNumber=; 如果Platform.OS==='android'{ let userMobile=`tel:${mobileNumber}` 电话号码=用户移动电话; } 否则{ let userMobile=`tel://${mobileNumber}` 电话号码=用户移动电话; } Linking.
我想知道如何用一些例子来处理openUrl承诺,我已经分享了我所做的代码。我使用的是react原生版本0.59.9您应该先查看是否有可用于处理url的应用程序
Linking.canOpenURL(phoneNumber)
.then((supported) => {
if (!supported) {
console.log("Can't handle url: " + url);
} else {
return Linking.openURL(url);
}
})
.catch((err) => console.error('An error occurred', err));
你们能给我举个例子吗?因为我甚至在githhub上也尝试过很多解决方案,我发现说链接是不一致的