├── android ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── harishn28 │ │ │ └── reactnativesignview │ │ │ ├── SignViewCallbacks.java │ │ │ ├── ReactNativeSignatureViewPackage.java │ │ │ ├── SignViewModule.java │ │ │ ├── SignViewManager.java │ │ │ └── SignatureView.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── harishn28 │ │ │ └── reactnativesignview │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── harishn28 │ │ └── reactnativesignview │ │ └── ExampleInstrumentedTest.java ├── build.gradle └── proguard-rules.pro ├── example └── sample │ ├── .gitattributes │ ├── app.json │ ├── babel.config.js │ ├── android │ ├── app │ │ ├── src │ │ │ └── main │ │ │ │ ├── res │ │ │ │ ├── values │ │ │ │ │ ├── strings.xml │ │ │ │ │ └── styles.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ └── mipmap-xxxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── sample │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ └── MainApplication.java │ │ │ │ └── AndroidManifest.xml │ │ ├── build_defs.bzl │ │ ├── proguard-rules.pro │ │ ├── BUCK │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── keystores │ │ ├── debug.keystore.properties │ │ └── BUCK │ ├── settings.gradle │ ├── gradle.properties │ ├── build.gradle │ ├── gradlew.bat │ └── gradlew │ ├── ios │ ├── sample │ │ ├── Images.xcassets │ │ │ ├── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── AppDelegate.h │ │ ├── main.m │ │ ├── AppDelegate.m │ │ ├── Info.plist │ │ └── Base.lproj │ │ │ └── LaunchScreen.xib │ ├── sample-tvOSTests │ │ └── Info.plist │ ├── sample-tvOS │ │ └── Info.plist │ └── sample.xcodeproj │ │ ├── xcshareddata │ │ └── xcschemes │ │ │ ├── sample.xcscheme │ │ │ └── sample-tvOS.xcscheme │ │ └── project.pbxproj │ ├── .buckconfig │ ├── index.js │ ├── __tests__ │ └── App.js │ ├── package.json │ ├── rn-cli.config.js │ ├── .gitignore │ ├── App.js │ └── .flowconfig ├── src ├── index.js └── SignatureView.js ├── ios ├── ReactNativeSignView.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── project.pbxproj └── ReactNativeSignView │ ├── SignViewCallbacks.h │ ├── RCTSignView.m │ ├── RCTSignView.h │ ├── SignView.h │ ├── SignViewManager.m │ └── SignView.m ├── package.json ├── LICENSE ├── README.md └── .gitignore /android/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /example/sample/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /example/sample/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sample", 3 | "displayName": "sample" 4 | } -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import SignatureView from './SignatureView'; 2 | 3 | export { 4 | SignatureView 5 | } 6 | -------------------------------------------------------------------------------- /example/sample/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ["module:metro-react-native-babel-preset"] 3 | } 4 | -------------------------------------------------------------------------------- /android/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | reactnativesignview 3 | 4 | -------------------------------------------------------------------------------- /example/sample/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | sample 3 | 4 | -------------------------------------------------------------------------------- /example/sample/ios/sample/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /example/sample/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /example/sample/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Harishn28/react-native-signview/HEAD/example/sample/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/sample/android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /example/sample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Harishn28/react-native-signview/HEAD/example/sample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/sample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Harishn28/react-native-signview/HEAD/example/sample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/sample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Harishn28/react-native-signview/HEAD/example/sample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/sample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Harishn28/react-native-signview/HEAD/example/sample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/sample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Harishn28/react-native-signview/HEAD/example/sample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/sample/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Harishn28/react-native-signview/HEAD/example/sample/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/sample/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Harishn28/react-native-signview/HEAD/example/sample/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/sample/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Harishn28/react-native-signview/HEAD/example/sample/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/sample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Harishn28/react-native-signview/HEAD/example/sample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/sample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Harishn28/react-native-signview/HEAD/example/sample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/sample/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /example/sample/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'sample' 2 | 3 | include ':reactnativesignview' 4 | project(':reactnativesignview').projectDir = new File(rootProject.projectDir, '../../../android') 5 | 6 | 7 | include ':app' 8 | -------------------------------------------------------------------------------- /ios/ReactNativeSignView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/sample/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/sample/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip 6 | -------------------------------------------------------------------------------- /example/sample/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | * @lint-ignore-every XPLATJSCOPYRIGHT1 4 | */ 5 | 6 | import {AppRegistry} from 'react-native'; 7 | import App from './App'; 8 | import {name as appName} from './app.json'; 9 | 10 | AppRegistry.registerComponent(appName, () => App); 11 | -------------------------------------------------------------------------------- /android/src/main/java/com/harishn28/reactnativesignview/SignViewCallbacks.java: -------------------------------------------------------------------------------- 1 | package com.harishn28.reactnativesignview; 2 | 3 | import android.content.Context; 4 | 5 | public interface SignViewCallbacks { 6 | void onSignAvailable(Context context, int targetId, String base64DataOfSign); 7 | } -------------------------------------------------------------------------------- /ios/ReactNativeSignView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/sample/__tests__/App.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | * @lint-ignore-every XPLATJSCOPYRIGHT1 4 | */ 5 | 6 | import 'react-native'; 7 | import React from 'react'; 8 | import App from '../App'; 9 | 10 | // Note: test renderer must be required after react-native. 11 | import renderer from 'react-test-renderer'; 12 | 13 | it('renders correctly', () => { 14 | renderer.create(); 15 | }); 16 | -------------------------------------------------------------------------------- /example/sample/ios/sample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | @interface AppDelegate : UIResponder 11 | 12 | @property (nonatomic, strong) UIWindow *window; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /ios/ReactNativeSignView/SignViewCallbacks.h: -------------------------------------------------------------------------------- 1 | // 2 | // SignViewCallbacks.h 3 | // ReactNativeSignView 4 | // 5 | // Created by Harish on 20/02/19. 6 | // Copyright © 2019 Tekion. All rights reserved. 7 | // 8 | 9 | #ifndef SignViewCallbacks_h 10 | #define SignViewCallbacks_h 11 | 12 | @protocol SignViewCallbacks 13 | @required 14 | -(void)onSignatureChangesCb: (NSString*) base64DataOfSign; 15 | @end 16 | 17 | #endif /* SignViewCallbacks_h */ 18 | -------------------------------------------------------------------------------- /example/sample/android/app/src/main/java/com/sample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.sample; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. 9 | * This is used to schedule rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "sample"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/sample/ios/sample/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /android/src/test/java/com/harishn28/reactnativesignview/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.harishn28.reactnativesignview; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /ios/ReactNativeSignView/RCTSignView.m: -------------------------------------------------------------------------------- 1 | // 2 | // RCTSignView.m 3 | // ReactNativeSignView 4 | // 5 | // Created by Harish on 20/02/19. 6 | // Copyright © 2019 Tekion. All rights reserved. 7 | // 8 | 9 | #import "UIKit/UIKit.h" 10 | #import "RCTSignView.h" 11 | 12 | 13 | @implementation RCTSignView 14 | 15 | @synthesize onSignAvailable; 16 | 17 | - (void) commonInit{ 18 | [super commonInit]; 19 | super.delegate = self; 20 | } 21 | 22 | -(void)onSignatureChangesCb: (NSString*) base64DataOfSign{ 23 | self.onSignAvailable(@{@"signature": base64DataOfSign}); 24 | } 25 | 26 | 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /ios/ReactNativeSignView/RCTSignView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RCTSignView.h 3 | // ReactNativeSignView 4 | // 5 | // Created by Harish on 20/02/19. 6 | // Copyright © 2019 Tekion. All rights reserved. 7 | // 8 | 9 | #ifndef RCTSignView_h 10 | #define RCTSignView_h 11 | 12 | #import 13 | #import 14 | #import 15 | #import "SignView.h" 16 | #import "SignViewCallbacks.h" 17 | 18 | 19 | @interface RCTSignView : SignView 20 | @property (nonatomic, copy) RCTDirectEventBlock onSignAvailable; 21 | @end 22 | 23 | #endif /* RCTSignView_h */ 24 | -------------------------------------------------------------------------------- /ios/ReactNativeSignView/SignView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SignView.h 3 | // ReactNativeSignView 4 | // 5 | // Created by Harish on 20/02/19. 6 | // Copyright © 2019 Tekion. All rights reserved. 7 | // 8 | 9 | #ifndef SignView_h 10 | #define SignView_h 11 | 12 | 13 | #import "UIKit/UIKit.h" 14 | #import "SignViewCallbacks.h" 15 | 16 | @interface SignView : UIView 17 | @property (nonatomic,strong) id delegate; 18 | 19 | -(void)setSignatureColor: (UIColor*) signColor; 20 | -(void)setStrokeWidth: (CGFloat) strokeWidth; 21 | -(void)clearSignature; 22 | - (void) commonInit; 23 | @end 24 | 25 | #endif /* SignView_h */ 26 | -------------------------------------------------------------------------------- /example/sample/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sample", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node node_modules/react-native/local-cli/cli.js start", 7 | "test": "jest" 8 | }, 9 | "dependencies": { 10 | "@babel/runtime": "^7.3.1", 11 | "react": "16.6.3", 12 | "react-native": "0.58.3" 13 | }, 14 | "devDependencies": { 15 | "babel-core": "^7.0.0-bridge.0", 16 | "babel-jest": "24.0.0", 17 | "jest": "24.0.0", 18 | "metro-react-native-babel-preset": "0.51.1", 19 | "react-test-renderer": "16.6.3" 20 | }, 21 | "jest": { 22 | "preset": "react-native" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | def getPropFromRootProj(prop, fallback) { 2 | rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback 3 | } 4 | 5 | 6 | 7 | apply plugin: 'com.android.library' 8 | 9 | android { 10 | compileSdkVersion getPropFromRootProj('compileSdkVersion', 28) 11 | 12 | defaultConfig { 13 | minSdkVersion getPropFromRootProj('minSdkVersion', 16) 14 | targetSdkVersion getPropFromRootProj('targetSdkVersion', 28) 15 | } 16 | } 17 | 18 | dependencies { 19 | implementation "com.facebook.react:react-native:+" 20 | implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" 21 | } 22 | 23 | -------------------------------------------------------------------------------- /example/sample/android/app/build_defs.bzl: -------------------------------------------------------------------------------- 1 | """Helper definitions to glob .aar and .jar targets""" 2 | 3 | def create_aar_targets(aarfiles): 4 | for aarfile in aarfiles: 5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] 6 | lib_deps.append(":" + name) 7 | android_prebuilt_aar( 8 | name = name, 9 | aar = aarfile, 10 | ) 11 | 12 | def create_jar_targets(jarfiles): 13 | for jarfile in jarfiles: 14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] 15 | lib_deps.append(":" + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | -------------------------------------------------------------------------------- /example/sample/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /example/sample/ios/sample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /example/sample/rn-cli.config.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const path = require('path'); 4 | 5 | const reactNativeSignview = path.resolve(__dirname, '..', '..'); 6 | 7 | const installedDependencies = require("./package.json").dependencies; 8 | 9 | const extraNodeModules = {}; 10 | Object.keys(installedDependencies).forEach(dep => { 11 | extraNodeModules[dep] = path.resolve(__dirname, "node_modules", dep); 12 | }); 13 | 14 | const installedDevDependencies = require("./package.json").devDependencies; 15 | 16 | Object.keys(installedDevDependencies).forEach(dep => { 17 | extraNodeModules[dep] = path.resolve(__dirname, "node_modules", dep); 18 | }); 19 | 20 | module.exports = { 21 | watchFolders: [path.resolve(__dirname, 'node_modules'), reactNativeSignview], 22 | resolver: { 23 | extraNodeModules: extraNodeModules 24 | } 25 | }; 26 | 27 | -------------------------------------------------------------------------------- /android/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-signview", 3 | "version": "1.0.6", 4 | "description": "Signature View for React Native(Android+IOS).", 5 | "main": "src/index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/Harishn28/react-native-signview.git" 12 | }, 13 | "keywords": [ 14 | "Signature", 15 | "android", 16 | "ios", 17 | "react-native" 18 | ], 19 | "author": "Harish", 20 | "license": "ISC", 21 | "bugs": { 22 | "url": "https://github.com/Harishn28/react-native-signview/issues" 23 | }, 24 | "homepage": "https://github.com/Harishn28/react-native-signview#readme", 25 | "publishConfig": { 26 | "registry": "https://registry.npmjs.org/" 27 | }, 28 | "dependencies": { 29 | "prop-types": "^15.7.2" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /example/sample/ios/sample-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /android/src/androidTest/java/com/harishn28/reactnativesignview/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.harishn28.reactnativesignview; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.harishn28.reactnativesignview.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /example/sample/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | -------------------------------------------------------------------------------- /android/src/main/java/com/harishn28/reactnativesignview/ReactNativeSignatureViewPackage.java: -------------------------------------------------------------------------------- 1 | package com.harishn28.reactnativesignview; 2 | 3 | import com.facebook.react.ReactPackage; 4 | import com.facebook.react.bridge.NativeModule; 5 | import com.facebook.react.bridge.ReactApplicationContext; 6 | import com.facebook.react.uimanager.ViewManager; 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | public class ReactNativeSignatureViewPackage implements ReactPackage { 11 | @Override 12 | public List createNativeModules(ReactApplicationContext reactContext) { 13 | ArrayList list = new ArrayList<>(); 14 | list.add(new SignViewModule(reactContext)); 15 | return list; 16 | } 17 | 18 | @Override 19 | public List createViewManagers(ReactApplicationContext reactContext) { 20 | ArrayList list = new ArrayList<>(); 21 | list.add(new SignViewManager()); 22 | return list; 23 | } 24 | } -------------------------------------------------------------------------------- /example/sample/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | 44 | # fastlane 45 | # 46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 47 | # screenshots whenever they are needed. 48 | # For more information about the recommended setup visit: 49 | # https://docs.fastlane.tools/best-practices/source-control/ 50 | 51 | */fastlane/report.xml 52 | */fastlane/Preview.html 53 | */fastlane/screenshots 54 | 55 | # Bundle artifact 56 | *.jsbundle 57 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Harish N 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /example/sample/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "28.0.3" 6 | minSdkVersion = 16 7 | compileSdkVersion = 28 8 | targetSdkVersion = 27 9 | supportLibVersion = "28.0.0" 10 | } 11 | repositories { 12 | google() 13 | jcenter() 14 | } 15 | dependencies { 16 | classpath 'com.android.tools.build:gradle:3.2.1' 17 | 18 | // NOTE: Do not place your application dependencies here; they belong 19 | // in the individual module build.gradle files 20 | } 21 | } 22 | 23 | allprojects { 24 | repositories { 25 | mavenLocal() 26 | google() 27 | jcenter() 28 | maven { 29 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 30 | url "$rootDir/../node_modules/react-native/android" 31 | } 32 | } 33 | } 34 | 35 | 36 | task wrapper(type: Wrapper) { 37 | gradleVersion = '4.7' 38 | distributionUrl = distributionUrl.replace("bin", "all") 39 | } 40 | -------------------------------------------------------------------------------- /example/sample/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 14 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /example/sample/ios/sample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import "AppDelegate.h" 9 | 10 | #import 11 | #import 12 | 13 | @implementation AppDelegate 14 | 15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 16 | { 17 | NSURL *jsCodeLocation; 18 | 19 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 20 | 21 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 22 | moduleName:@"sample" 23 | initialProperties:nil 24 | launchOptions:launchOptions]; 25 | rootView.backgroundColor = [UIColor blackColor]; 26 | 27 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 28 | UIViewController *rootViewController = [UIViewController new]; 29 | rootViewController.view = rootView; 30 | self.window.rootViewController = rootViewController; 31 | [self.window makeKeyAndVisible]; 32 | return YES; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /example/sample/android/app/src/main/java/com/sample/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.sample; 2 | 3 | import android.app.Application; 4 | 5 | import com.facebook.react.ReactApplication; 6 | import com.facebook.react.ReactNativeHost; 7 | import com.facebook.react.ReactPackage; 8 | import com.facebook.react.shell.MainReactPackage; 9 | import com.facebook.soloader.SoLoader; 10 | import com.harishn28.reactnativesignview.ReactNativeSignatureViewPackage; 11 | 12 | import java.util.Arrays; 13 | import java.util.List; 14 | 15 | public class MainApplication extends Application implements ReactApplication { 16 | 17 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 18 | @Override 19 | public boolean getUseDeveloperSupport() { 20 | return BuildConfig.DEBUG; 21 | } 22 | 23 | @Override 24 | protected List getPackages() { 25 | return Arrays.asList( 26 | new MainReactPackage(), 27 | new ReactNativeSignatureViewPackage() 28 | ); 29 | } 30 | 31 | @Override 32 | protected String getJSMainModuleName() { 33 | return "index"; 34 | } 35 | }; 36 | 37 | @Override 38 | public ReactNativeHost getReactNativeHost() { 39 | return mReactNativeHost; 40 | } 41 | 42 | @Override 43 | public void onCreate() { 44 | super.onCreate(); 45 | SoLoader.init(this, /* native exopackage */ false); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /ios/ReactNativeSignView/SignViewManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // SignViewManager.m 3 | // ReactNativeSignView 4 | // 5 | // Created by Harish on 11/02/19. 6 | // 7 | 8 | #import 9 | #import 10 | #import 11 | #import 12 | #import "SignView.h" 13 | #import "RCTSignView.h" 14 | 15 | @interface SignViewManager : RCTViewManager 16 | @end 17 | 18 | 19 | @implementation SignViewManager 20 | 21 | RCT_EXPORT_MODULE(); 22 | 23 | - (UIView *)view 24 | { 25 | RCTSignView *signView = [[RCTSignView alloc] init]; 26 | return signView; 27 | } 28 | 29 | 30 | RCT_EXPORT_VIEW_PROPERTY(onSignAvailable, RCTDirectEventBlock); 31 | 32 | RCT_CUSTOM_VIEW_PROPERTY(signatureColor, UIColor , RCTSignView){ 33 | [view setSignatureColor: [RCTConvert UIColor:json]]; 34 | } 35 | 36 | RCT_CUSTOM_VIEW_PROPERTY(strokeWidth, CGFloat , RCTSignView){ 37 | [view setStrokeWidth: [RCTConvert CGFloat:json]]; 38 | } 39 | 40 | RCT_EXPORT_METHOD(clearSignature:(nonnull NSNumber *)reactTag){ 41 | [self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { 42 | RCTSignView *signView = viewRegistry[reactTag]; 43 | 44 | if ([signView isKindOfClass:[RCTSignView class]]) { 45 | [signView clearSignature]; 46 | } else{ 47 | NSLog(@"Expecting "); 48 | } 49 | }]; 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /android/src/main/java/com/harishn28/reactnativesignview/SignViewModule.java: -------------------------------------------------------------------------------- 1 | package com.harishn28.reactnativesignview; 2 | 3 | import android.util.Log; 4 | 5 | import com.facebook.react.bridge.ReactApplicationContext; 6 | import com.facebook.react.bridge.ReactContextBaseJavaModule; 7 | import com.facebook.react.bridge.ReactMethod; 8 | import com.facebook.react.uimanager.NativeViewHierarchyManager; 9 | import com.facebook.react.uimanager.UIBlock; 10 | import com.facebook.react.uimanager.UIManagerModule; 11 | 12 | public class SignViewModule extends ReactContextBaseJavaModule { 13 | public SignViewModule(ReactApplicationContext reactContext) { 14 | super(reactContext); 15 | } 16 | 17 | @Override 18 | public String getName() { 19 | return "SignViewModule"; 20 | } 21 | 22 | @ReactMethod 23 | public void clearSignature(final int viewTag){ 24 | ReactApplicationContext context = getReactApplicationContext(); 25 | UIManagerModule uiManager = context.getNativeModule(UIManagerModule.class); 26 | uiManager.addUIBlock(new UIBlock() { 27 | @Override 28 | public void execute(NativeViewHierarchyManager nativeViewHierarchyManager) { 29 | try{ 30 | SignatureView signatureView = (SignatureView)nativeViewHierarchyManager.resolveView(viewTag); 31 | signatureView.clearSignature(); 32 | }catch (Exception ex){ 33 | 34 | } 35 | } 36 | }); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /example/sample/android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") 12 | 13 | lib_deps = [] 14 | 15 | create_aar_targets(glob(["libs/*.aar"])) 16 | 17 | create_jar_targets(glob(["libs/*.jar"])) 18 | 19 | android_library( 20 | name = "all-libs", 21 | exported_deps = lib_deps, 22 | ) 23 | 24 | android_library( 25 | name = "app-code", 26 | srcs = glob([ 27 | "src/main/java/**/*.java", 28 | ]), 29 | deps = [ 30 | ":all-libs", 31 | ":build_config", 32 | ":res", 33 | ], 34 | ) 35 | 36 | android_build_config( 37 | name = "build_config", 38 | package = "com.sample", 39 | ) 40 | 41 | android_resource( 42 | name = "res", 43 | package = "com.sample", 44 | res = "src/main/res", 45 | ) 46 | 47 | android_binary( 48 | name = "app", 49 | keystore = "//android/keystores:debug", 50 | manifest = "src/main/AndroidManifest.xml", 51 | package_type = "debug", 52 | deps = [ 53 | ":app-code", 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /example/sample/App.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | import React, {Component} from 'react'; 4 | import {Platform, StyleSheet, Text, Button, View} from 'react-native'; 5 | import { SignatureView } from 'react-native-signview'; 6 | 7 | export default class App extends Component { 8 | constructor(props){ 9 | super(props); 10 | this.signView = React.createRef(); 11 | } 12 | 13 | clearSignature = () => { 14 | if(this.signView && this.signView.current){ 15 | this.signView.current.clearSignature(); 16 | } 17 | } 18 | 19 | onChangeInSign = (base64StringOfSign) => { 20 | if(base64StringOfSign){ 21 | console.log('Signature Available', base64StringOfSign); 22 | } else{ 23 | console.log('No Signature'); 24 | } 25 | } 26 | 27 | render() { 28 | return ( 29 | 30 | Sign in below box 31 | 38 |