React Native Digits
Getting Started
Installation
npm install react-native-digits --save
Setup iOS
See React Native documentation on Linking Libraries
- Open your project in XCode
- Right click on
Libraries
and clickAdd Files to "YOUR_PROJECT _NAME"
- Add
libRNDigits.a
toBuild Phases -> Link Binary With Libraries
Setup Android
settings.gradle
In Add to bottom:
include ':react-native-digits'.projectDir = new File(settingsDir, '../node_modules/react-native-digits')
android/build.gradle
In allprojects { repositories { maven { url 'https://maven.fabric.io/public' } <--- ADD THIS }}
android/app/build.gradle
In dependencies { compile compile 'com.android.support:appcompat-v7:23.0.0' compile 'com.facebook.react:react-native:0.14.+' compile <--- ADD THIS}
MainActivity.java
In <--- ADD THIS
AndroidManifest.xml
In Add this inside the application
tag.
Android Custom Theme
In android/app/src/main/res/values/styles.xml
... @android:color/black @android:color/darker_gray @android:color/white #000000 #000000 #000000
Usage
{ this console } { this console } { return <View> <Button onPress= this > Login </Button> <Digits accentColor=“#16a085” backgroundColor=“#ffffff” onError=thishandleDigitsError onLogin=thishandleDigitsLogin /> </View> }
Properties
Prop | Default | Type | Description |
---|---|---|---|
accentColor | string |
The main color of elements associated with user actions (e.g. buttons). | |
backgroundColor | string |
The background color for all views in the Digits flow. | |
onError | (err) => console.warn(err) |
function |
Callback on error. |
onLogin | function |
Callback on success. credentials are passed back. |
|
visible | false |
bool |
Show the Digits viewController |