react-native-persona
Development
First, run yarn in the project root.
$ yarn
To test changes to SDK, we will use the Example App in example
app.
Install dependencies for example app
We will be using this example app to test our plugin. The plugin cannot compile
on it's own and needs an example app to act as a "harness" for testing.
$ cd example
$ yarn
iOS only: Install Pods
Make sure you have Cocoapods installed.
Then, install iOS pods.
$ cd ios
$ pod install
Android only: Ensure you have proper SDK/gradle version
Ensure you have the proper Java and Gradle version installed. If you haven't installed these yet,
you can install sdkman
$ sdk current java
Using java version 8.0.242.hs-adpt
$ sdk current gradle
Using gradle version 5.6.4
If the versions do not line up, please run sdk install java 8.0.242.hs-adpt
and sdk install gradle 5.6.4
.
Start metro bundler. This will bundle JS and serve it to your React Native sample app.
$ cd example
$ yarn start --reset-cache
Metro bundler compiles source code and caches compiled targets to speed up incremental rebuilds. However, it's possible
that this can lead to random failures if things get out of sync. If you ever run into any weird issues, it's worth running
yarn start --reset-cache
again.
Start example app in iOS simulator
Open ios/example.xcworkspace
in XCode and build + run.
Or use the built-in CLI command.
yarn ios
Start example app in Android simulator
Open the android project in Android Studio and build + run.
Or use the built-in CLI command.
yarn android
Installing in your own project
yarn add react-native-persona --save
Mostly automatic installation
On React Native version 0.60.0 and above, you're done!
On React Native versions < 0.60.0, you will need to manually link.
react-native link react-native-persona
Usage
import Inquiry from "react-native-persona";
Inquiry.fromTemplate("tmpl_20dk2j3hfhdnsja92k3")
.onSuccess(handleSuccess)
.onCancelled(handleCancelled)
.onFailed(handleFailed)
.onError(handleError)
.build()
.start();