diff --git a/.gitignore b/.gitignore
index 94fc8671..6c1c6952 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,6 +27,7 @@ project.xcworkspace
.idea
.gradle
local.properties
+*.iml
# node.js
#
diff --git a/README.md b/README.md
index e632be23..a643ca3f 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,5 @@
+Forked from https://github.com/RepairShopr/react-native-signature-capture.
+
# react-native-signature-capture
## About this
diff --git a/RNSignatureCapture.podspec b/RNSignatureCapture.podspec
new file mode 100644
index 00000000..c3a1a4c6
--- /dev/null
+++ b/RNSignatureCapture.podspec
@@ -0,0 +1,18 @@
+require "json"
+
+package = JSON.parse(File.read(File.join(__dir__, "package.json")))
+
+Pod::Spec.new do |s|
+ s.name = "RNSignatureCapture"
+ s.version = package["version"]
+ s.summary = "React Native library for capturing signature"
+ s.homepage = "https://github.com/QDivision/react-native-signature-capture"
+ s.license = "MIT"
+ s.author = { "RepairShopr" => "https://github.com/RepairShopr" }
+ s.platform = :ios, "8.0"
+ s.source = { :git => "https://github.com/QDivision/react-native-signature-capture.git", :tag => "#{s.version}" }
+
+ s.source_files = "ios/**/*.{h,m}"
+
+ s.dependency "React"
+end
\ No newline at end of file
diff --git a/SignatureCapture.js b/SignatureCapture.js
index 0e675be8..ac4413f4 100644
--- a/SignatureCapture.js
+++ b/SignatureCapture.js
@@ -74,7 +74,7 @@ class SignatureCapture extends React.Component {
saveImage() {
UIManager.dispatchViewManagerCommand(
ReactNative.findNodeHandle(this),
- UIManager.RSSignatureView.Commands.saveImage,
+ UIManager.getViewManagerConfig('RSSignatureView').Commands.saveImage,
[],
);
}
@@ -82,7 +82,7 @@ class SignatureCapture extends React.Component {
resetImage() {
UIManager.dispatchViewManagerCommand(
ReactNative.findNodeHandle(this),
- UIManager.RSSignatureView.Commands.resetImage,
+ UIManager.getViewManagerConfig('RSSignatureView').Commands.resetImage,
[],
);
}
diff --git a/android/android.iml b/android/android.iml
deleted file mode 100644
index 76d7bb05..00000000
--- a/android/android.iml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/build.gradle b/android/build.gradle
index beafef4f..bd8f0274 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -1,12 +1,12 @@
apply plugin: 'com.android.library'
android {
- compileSdkVersion 23
- buildToolsVersion "23.0.1"
+ compileSdkVersion 33
+ buildToolsVersion "30.0.2"
defaultConfig {
- minSdkVersion 16
- targetSdkVersion 22
+ minSdkVersion 23
+ targetSdkVersion 33
versionCode 1
versionName "1.0"
ndk {
@@ -15,7 +15,33 @@ android {
}
}
+buildscript {
+ repositories {
+ google()
+ mavenCentral()
+ gradlePluginPortal()
+ }
+ dependencies {
+ classpath("com.android.tools.build:gradle:7.0.4")
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ mavenCentral()
+ mavenLocal()
+ gradlePluginPortal()
+ maven {
+ // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
+ url "$rootDir/../node_modules/react-native/android"
+ }
+ }
+}
+
dependencies {
- compile 'com.android.support:appcompat-v7:23.0.0'
- compile 'com.facebook.react:react-native:0.19.+'
-}
\ No newline at end of file
+ implementation 'com.facebook.react:react-native:+'
+}
diff --git a/android/gradle.properties b/android/gradle.properties
new file mode 100644
index 00000000..c62d03dc
--- /dev/null
+++ b/android/gradle.properties
@@ -0,0 +1,21 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
+org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+
+android.useAndroidX=true
+android.enableJetifier=true
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index f23df6e4..2e6e5897 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Wed Oct 21 11:34:03 PDT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml
index e9b7fe2e..4cdb3937 100644
--- a/android/src/main/AndroidManifest.xml
+++ b/android/src/main/AndroidManifest.xml
@@ -1,3 +1,3 @@
-
+
\ No newline at end of file
diff --git a/android/src/main/java/com/rssignaturecapture/RSSignatureCaptureView.java b/android/src/main/java/com/rssignaturecapture/RSSignatureCaptureView.java
index 35f42efb..ca6b3021 100644
--- a/android/src/main/java/com/rssignaturecapture/RSSignatureCaptureView.java
+++ b/android/src/main/java/com/rssignaturecapture/RSSignatureCaptureView.java
@@ -2,10 +2,6 @@
import android.content.Context;
-import android.content.res.Resources;
-import android.content.res.TypedArray;
-
-import android.util.Log;
import android.view.View;
import android.view.MotionEvent;
@@ -86,23 +82,26 @@ public RSSignatureCaptureView(Context context, SignatureCallback callback) {
}
/**
- * Get signature
- *
- * @return
+ * Get signature as a Bitmap
*/
public Bitmap getSignature() {
+ // Initialize a Bitmap to contain the signature
+ Bitmap signatureBitmap = Bitmap.createBitmap(this.getWidth(), this.getHeight(), Bitmap.Config.ARGB_8888);
- Bitmap signatureBitmap = null;
-
- // set the signature bitmap
- if (signatureBitmap == null) {
- signatureBitmap = Bitmap.createBitmap(this.getWidth(), this.getHeight(), Bitmap.Config.RGB_565);
- }
-
- // important for saving signature
+ // This view's pixels constitute the signature, so draw this view onto the signatureBitmap
final Canvas canvas = new Canvas(signatureBitmap);
this.draw(canvas);
+ // The signatureBitmap now contains the signature with a white background,
+ // so we will change it to a transparent background.
+ for (int x = 0; x < signatureBitmap.getWidth(); x++) {
+ for (int y = 0; y < signatureBitmap.getHeight(); y++) {
+ if (Color.WHITE == signatureBitmap.getPixel(x, y)) {
+ signatureBitmap.setPixel(x, y, Color.TRANSPARENT);
+ }
+ }
+ }
+
return signatureBitmap;
}
diff --git a/package.json b/package.json
index 324f57c6..7d905fa3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
- "name": "react-native-signature-capture",
- "version": "0.4.7",
+ "name": "@qdivision/react-native-signature-capture",
+ "version": "0.5.3",
"description": "Lets users sign their signatures",
"main": "SignatureCapture.js",
"scripts": {
@@ -8,23 +8,24 @@
},
"repository": {
"type": "git",
- "url": "git+https://github.com/RepairShopr/react-native-signature-capture.git"
+ "url": "git+https://github.com/QDivision/react-native-signature-capture.git"
},
"keywords": [
"react-component",
"react-native",
"ios",
+ "android",
"signature"
],
"peerDependencies": {
"react-native": ">=0.47"
},
- "author": "RepairShopr",
+ "author": "QDivision",
"license": "ISC",
"bugs": {
- "url": "https://github.com/RepairShopr/react-native-signature-capture/issues"
+ "url": "https://github.com/QDivision/react-native-signature-capture/issues"
},
- "homepage": "https://github.com/RepairShopr/react-native-signature-capture#readme",
+ "homepage": "https://github.com/QDivision/react-native-signature-capture#readme",
"dependencies": {
"prop-types": "^15.5.10"
}