react-native-flyover
A simple React Native native flyover for invoking Activity.startActivityForResult
, Activity.setResult
, and Activity.finish
to help with implementing app-to-app communication.
Getting started
$ npm install react-native-flyover --save
Mostly automatic installation
$ react-native link react-native-flyover
Manual installation
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.kashish.FlyOverPackage;
to the imports at the top of the file - Add
new FlyOverPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-flyover' project(':react-native-flyover').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-flyover/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-flyover')
Usage
; // Check if an app is installed to handle an intentconst flyover = await FlyOver;if !flyover console; else console; // naked startActivity replacement FlyOver; // Start an activity for a resultlet uniqueId = 0;let args = /* ... */;const response = await FlyOver;if responseresultCode !== FlyOverOK throw 'Invalid result from activity.'; else console; // Finish an activity with a resultKFlyOver;