$ npm install com.payu.custombrowser.react-native --save
$ react-native link com.payu.custombrowser.react-native
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.cbwrapper.CBPackage;
to the imports at the top of the file - Add
new CBPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':com.payu.custombrowser.react-native' project(':com.payu.custombrowser.react-native').projectDir = new File(rootProject.projectDir, '../node_modules/cb-wrapper/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':com.payu.custombrowser.react-native')
import CBPackage from 'com.payu.custombrowser.react-native';
import {NativeModules} from 'react-native';
NativeModules.CBWrapper.startPayment(params).then(response => {
Alert.alert(response);
}).catch(error => Alert.alert(error));
}}