@waqqas/react-native-braintree-dropin
v0.0.3
Published
React-Native binding to Braintree native Dropin UIs
Downloads
5
Readme
react-native-braintree-dropin
Getting started
$ npm install react-native-braintree-dropin --save
Mostly automatic installation
$ react-native link react-native-braintree-dropin
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-braintree-dropin
and addRNBraintreeDropin.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNBraintreeDropin.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.waqqasjabbar.braintree.RNBraintreeDropinPackage;
to the imports at the top of the file - Add
new RNBraintreeDropinPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-braintree-dropin' project(':react-native-braintree-dropin').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-braintree-dropin/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-braintree-dropin')
Usage
import RNBraintreeDropin from 'react-native-braintree-dropin';
RNBraintreeDropin.showDropin('braintreeToken').then(result => {
console.log('nonce:', result.nonce);
}).catch(err => {
console.log('error: ', err);
});