In this tutorial, you will use the Expo SDK MailComposer to enable your application to send emails using the native email application on the device. At the end of this tutorial, you will be able to:
4.1.1 How to
1. Install expo-mail-composer (tested on v11.2.0).
2. Update 'components/ContactComponent.js' file.
... | |
import { ..., Button, Icon } from 'react-native-elements'; | |
import * as MailComposer from 'expo-mail-composer'; | |
class Contact extends Component { | |
render() { | |
return ( | |
<Animatable.View ...> | |
<Card> | |
... | |
<Button title=' Compose Email' buttonStyle={{ backgroundColor: '#7cc' }} | |
icon={<Icon name='envelope-o' type='font-awesome' color='white' />} | |
onPress={this.composeMail} /> | |
</Card> | |
</Animatable.View> | |
); | |
} | |
composeMail() { | |
MailComposer.composeAsync({ | |
recipients: ['<email_address>'], | |
subject: 'From Confusion', | |
body: 'Hello my friends ...' | |
}); | |
} | |
} | |
... |
4.1.2 Screenshots