https://github.com/verypossible/react-native-mail-launcher
Launch mail app from react-native application
https://github.com/verypossible/react-native-mail-launcher
native-module react react-native
Last synced: 10 months ago
JSON representation
Launch mail app from react-native application
- Host: GitHub
- URL: https://github.com/verypossible/react-native-mail-launcher
- Owner: verypossible
- Created: 2018-10-30T15:59:00.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-01-14T13:42:08.000Z (about 6 years ago)
- Last Synced: 2025-03-27T06:32:46.312Z (11 months ago)
- Topics: native-module, react, react-native
- Language: Java
- Size: 70.3 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-native-mail-launcher
Launch mail app from react-native application
## Getting started
`$ npm install react-native-mail-launcher --save`
### Mostly automatic installation
`$ react-native link react-native-mail-launcher`
#### Android
1. Open up `android/app/src/main/java/[...]/MainActivity.java`
- Add `import com.reactlibrary.RNMailLauncherPackage;` to the imports at the top of the file
- Add `new RNMailLauncherPackage()` to the list returned by the `getPackages()` method
2. Append the following lines to `android/settings.gradle`:
```
include ':react-native-mail-launcher'
project(':react-native-mail-launcher').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-mail-launcher/android')
```
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
```
compile project(':react-native-mail-launcher')
```
#### iOS
We do not need a native module for iOS
## Usage
```javascript
import * as React from "react";
import { View, Button } from "react-native";
import launchMailApp from "react-native-mail-launcher";
export default class Example extends React.Component {
openMail = () => {
launchMailApp();
};
render() {
return (
Go to mail client
);
}
}
```