0.0.5 • Published 4 years ago

terra-module-js v0.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

Payment SDK for React Native

This module help us to use many Terra module in React native

Project setup

This repo was published internal by Teko, so you need to define user token to download this library. In local.properties add this

githubUser=<your-github-username>
githubToken=<github-personal-access-token>

Instruction how to generate this token, your token need read-package permission : https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line

Then add this maven repo to project's build.gradle

allprojects {
    repositories {
        ...
        maven {
            name = "TekoMaven"
            url = uri("https://maven.pkg.github.com/teko-vn/terra-sdk-android")

            credentials {
                Properties properties = new Properties()
                properties.load(project.rootProject.file('local.properties').newDataInputStream())

                username = properties.getProperty('githubUser')
                password = properties.getProperty('githubToken')
            }
        }
    }
}

Install

npm install --save terra-module-js

or

yarn add terra-module-js

In android folder, add these dependencies to app's build.gradle

implementation "vn.teko.terra:terra-rn-bridge:x.x.x"
implementation "vn.teko.android.payment:react-native-bridge:x.x.x"

Look for the latest version here

In the same file add this line

android {
    packagingOptions {
        ...
        exclude("META-INF/*.kotlin_module")
    }
}

If you get error: Out of memory: GC overhead limit exceeded., add org.gradle.jvmargs=-Xmx4G to gradle.properties

Add this package to getPackages function in MainApplication.java

import vn.teko.android.terra.reactnative.bridge.TerraPackage;
...
packages.add(new TerraPackage());

Now in your javascript file, you can include your module you need

import { PaymentModule } from 'terra-module-js`

Modules

There are some module which you can use in React native

  • Payment Module
  • Listing Module (Coming soon)
  • Authentication Module (Coming soon)