Giter VIP home page Giter VIP logo

react-native-fabric-digits's Introduction

react-native-fabric-digits

Introduction

Fabric Digits wrapper for React-Native.

Special thanks to jpdriver for his tutorial on how to integrate Digits in a React-Native project.

Install

  1. npm install react-native-fabric-digits --save

iOS procedure

  1. In the XCode's "Project navigator", right click on your project's Libraries folder ➜ Add Files to <...>
  2. Go to node_modulesreact-native-fabric-digitsios -> select the RNFabricDigits.xcodeproj
  3. Go to Build Phases tab of your project, select a target, open Link Binary With Libraries, click on + and add libRNFabricDigits.a

Example

You can try the test project in the example directory. Don't forget to run npm install in the example directory to be able to run the project!

Usage

This package provide three classes: DigitsAuthenticateMaanger, DigitsLoginButton (optional) and DigitsLogoutButton (optional).

You can simply use the login and logout buttons provided to trigger the authentication or logout flows as bellow:

var Digits = require('react-native-fabric-digits');
var { DigitsLoginButton, DigitsLogoutButton } = Digits;

// ...

completion: function(error, response) {
  // Your code here.
},

// ...

<DigitsLoginButton
  options={{
    title: "Connect with your phone",
    appearance: {
      backgroundColor: {
        hex: "#ffffff",
        alpha: 1.0
      },
      accentColor: {
        hex: "#43a16f",
        alpha: 0.7
      },
      headerFont: {
        name: "Arial",
        size: 16
      },
      labelFont: {
        name: "Helvetica",
        size: 18
      },
      bodyFont: {
        name: "Helvetica",
        size: 16
      }
    }
  }}
  completion={this.completion}
  text="Use my phone number"
  buttonStyle={styles.DigitsAuthenticateButton}
  textStyle={styles.DigitsAuthenticateButtonText}
/>

...

<DigitsLogoutButton
  completion={this.completion}
  text="Logout"
  buttonStyle={styles.DigitsAuthenticateButton}
  textStyle={styles.DigitsAuthenticateButtonText}
/>

Or you can directly use methods from the DigitsAuthenticateManager class:

var Digits = require('react-native-fabric-digits');
var { DigitsAuthenticateManager } = Digits;

// ...

DigitsAuthenticateManager.authenticateDigitsWithOptions(options, completion);

// ...

DigitsAuthenticateManager.logout();

Roadmap

  • Android support.

Licence

MIT

react-native-fabric-digits's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.