0.2.0 • Published 5 years ago

@fluidcoins/react-native-mono v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

react-native-mono

This package allows you implement the Mono widget in your React Native application.

Demo can be found at https://recordit.co/zJGP7SKbee

Installation

  • NPM
$ npm install react-native-webview @fluidcoins/react-native-mono
  • Yarn
$ yarn add react-native-webview @fluidcoins/react-native-mono

This library only requires react-native-webview as a peer dependency. This is to prevent having to deal with npm's multiple multiple versions issues. If you have it installed already in your project, you can install this library only

Linking

None :)

Although, if you installed react-native-webview, you will need to run npx pod-install

Usage

import Mono from '@fluidcoins/react-native-mono';
import {View} from 'react-native';
import React, {useEffect} from 'react';
import {useDispatch} from 'react-redux';

const ConnectMono = ({navigation}) => {
  const dispatch = useDispatch();

  return (
    <View style={{flex: 1}}>
      <Mono
        publicKey={'test_pk_XYZ'}
        onClose={(e) => {
          navigation.pop();
        }}
        onSuccess={(code) => {
          console.log('Code from Mono', code);
          // Connect to backend here
          // dispatch(authenticateMonocode(code))
          navigation.pop();
        }}
      />
    </View>
  );
};

export default ConnectMono;

Props

These props are currently available

  • publicKey : This is your mono public key. Please don't make use of your secret key.
  • onClose: This is called when the Mono widget is closed
  • onSuccess(code): This is called when the user successfully authenticate with Mono. The code should be sent to the backend for authorization and account retrieval.
  • loaderColor : Before Mono is loaded, an ActivityIndicator is shown, this prop configures the color. If not provided, it defaults to #035AA6
0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago