1234567891011121314151617181920212223 |
- import {Alert, Linking} from "react-native";
- import {Toast} from "@ant-design/react-native";
- import SyncStorage from "sync-storage";
- const CallPhone = (phone, call_type='') => {
- /**
- * 拨打电话
- * @param {string} phone
- * @example
- * call('18888888888')
- */
- const url = `tel:${phone}`;
- Linking.canOpenURL(url).then(supported => {
- if (!supported) {
- return Alert.alert('提示', `您的设备不支持该功能,请手动拨打 ${phone}`, [
- {text: '确定'}
- ]);
- }
- return Linking.openURL(url);
- }).catch(err => Toast.info('拨号错误'))
- }
- export default CallPhone;
|