import React from 'react';
import { Button, View , Linking, SMS, Permissions, StyleSheet} from 'react-native';
export default class App extends React.Component {
render() {
return (
<View style={StyleSheet.container}>
<Button title="phone" onPress={this.btnPhoneClicked} />
<Button title="SMS" onPress={this.btnSMSClicked} />
</View>
);
}
askLKermissionsAsync = async () => {
await Permissions.askAsync(Permissions.Linking);
};
askSMSPermissionsAsync = async () => {
await Permissions.askAsync(Permissions.SMS);
};
btnPhoneClicked = async () => {
this.askLKermissionsAsync();
let result = await Linking.openURL('tel:');
};
btnSMSClicked = async () => {
//await this.askLKermissionsAsync();
//let result = await Linking.openURL('sms:');
await this.askSMSPermissionsAsync();
let result = await SMS.sendSMSAsync([''], '');
};
}
const styles = StyleSheet.create({
container:{
flex:1
}
})
No comments:
Post a Comment