GithubHelp home page GithubHelp logo

forki / react-native-signature-view Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zoomyu/react-native-signature-view

0.0 3.0 1.0 524 KB

A react-native component for signing.

License: MIT License

JavaScript 7.30% Java 29.48% Python 2.65% Objective-C 60.56%

react-native-signature-view's Introduction

react-native-signature-view

npm Version Build Status License npm

SignatureView component for React Native (Android and iOS)

Getting Started

npm i --save react-native-signature-view

Mostly automatic installation

react-native link react-native-signature-view

Manual installation

Android

Edit android/settings.gradle to look like this:

include ':app'

+ include ':react-native-signature-view'
+ project(':react-native-signature-view').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-signature-view/android')

Edit android/app/build.gradle to look like this:

dependencies {
  compile fileTree(dir: "libs", include: ["*.jar"])
  compile "com.android.support:appcompat-v7:23.0.1"
  compile "com.facebook.react:react-native:+"  // From node_modules
+ compile project(':react-native-signature-view')
}

only RN 0.29+ Edit your MainApplication.java (deep in android/app/src/main/java/...) to look like this (note two places to edit):

+ import com.react_native_signature.RCTSignaturePackage;
...
  new MainReactPackage(),
+ new RCTSignaturePackage()
}

iOS

- Welcome iOS developer join, write this component together!
  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-signature-view and add ios/RCTSignatureView.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRCTSignatureView.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Properties

  • signatureColor : FontColor of the signature, you can use HEX or RGBA color codes

  • watermarkString : Content of the watermark

  • watermarkSize : FontSize of the watermark

  • watermarkColor : FontColor of the watermark, you can use HEX or RGBA color codes

  • watermarkAngle : Watermark rotation angle,

  • watermarkLineSpacing : Line spacing between watermarks

  • watermarkWordSpacing : Word spacing between watermarks

Methods

  • _saveSignature() : when called it will save the signature and returns savePath on onSaveEvent() callback

  • _resetSignature() : when called it will clear the signature on the canvas

Callback Props

  • onSaveEvent : Triggered when _saveSignature() is called, which return signature file path.

Usage

To see all available function take a look at App.js

  <SignatureView
    ref={'sign'}
    style={{flex:1}}
    watermarkString={'ORDER--12345678'}
    watermarkSize={14}
    watermarkColor={'#888888'}
    signatureColor={'#000000'}
    watermarkLineSpacing={20}
    watermarkWordSpacing={10}
    watermarkAngle={45}
    onSaveEvent={(msg)=>{
      console.log('onSaveEvent --->>', msg);
    }}
  />

License

MIT

react-native-signature-view's People

Contributors

forki avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

rborn

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.