react-native-signature-canvas 4.3.0 → 4.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.d.ts +2 -2
- package/index.js +9 -4
- package/package.json +3 -6
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ import SignatureScreen from 'react-native-signature-canvas';
|
|
|
58
58
|
| bgSrc | `string` | background image source uri (_url_) |
|
|
59
59
|
| clearText | `string` | clear button text |
|
|
60
60
|
| confirmText | `string` | save button text |
|
|
61
|
-
| customHtml | `
|
|
61
|
+
| customHtml | `(injectedJavaScript: string) => string` | html string that lets you modify things like the layout or elements |
|
|
62
62
|
| dataURL | `string` | default is "", Base64 string, draws saved signature from dataURL. |
|
|
63
63
|
| descriptionText | `string` | description text for signature |
|
|
64
64
|
| dotSize | `number` | radius of a single dot _(not stroke width)_ |
|
package/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ declare module "react-native-signature-canvas" {
|
|
|
17
17
|
bgSrc?: string;
|
|
18
18
|
clearText?: string;
|
|
19
19
|
confirmText?: string;
|
|
20
|
-
customHtml?: string
|
|
20
|
+
customHtml?: (injectedJavaScript: string) => string;
|
|
21
21
|
dataURL?: DataURL;
|
|
22
22
|
descriptionText?: string;
|
|
23
23
|
dotSize?: number;
|
|
@@ -31,7 +31,7 @@ declare module "react-native-signature-canvas" {
|
|
|
31
31
|
onRedo?: () => void;
|
|
32
32
|
onDraw?: () => void;
|
|
33
33
|
onErase?: () => void;
|
|
34
|
-
onGetData?: () => void;
|
|
34
|
+
onGetData?: (data: any) => void;
|
|
35
35
|
onChangePenColor?: () => void;
|
|
36
36
|
onChangePenSize?: () => void;
|
|
37
37
|
onBegin?: () => void;
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useMemo, useRef, forwardRef, useImperativeHandle } from "react";
|
|
1
|
+
import React, { useState, useEffect, useMemo, useRef, forwardRef, useImperativeHandle } from "react";
|
|
2
2
|
import { View, StyleSheet, ActivityIndicator } from "react-native";
|
|
3
3
|
|
|
4
4
|
import htmlContent from "./h5/html";
|
|
@@ -69,7 +69,7 @@ const SignatureView = forwardRef(({
|
|
|
69
69
|
injectedJavaScript = injectedJavaScript.replace(/<%dotSize%>/g, dotSize);
|
|
70
70
|
injectedJavaScript = injectedJavaScript.replace(/<%minWidth%>/g, minWidth);
|
|
71
71
|
injectedJavaScript = injectedJavaScript.replace(/<%maxWidth%>/g, maxWidth);
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
let html = htmlContentValue(injectedJavaScript);
|
|
74
74
|
html = html.replace(/<%bgWidth%>/g, bgWidth);
|
|
75
75
|
html = html.replace(/<%bgHeight%>/g, bgHeight);
|
|
@@ -84,8 +84,13 @@ const SignatureView = forwardRef(({
|
|
|
84
84
|
html = html.replace(/<%orientation%>/g, rotated);
|
|
85
85
|
|
|
86
86
|
return { html };
|
|
87
|
-
}, [customHtml, autoClear, trimWhitespace, rotated, imageType, webStyle, descriptionText, confirmText, clearText, dataURL])
|
|
88
|
-
|
|
87
|
+
}, [customHtml, autoClear, trimWhitespace, rotated, imageType, webStyle, descriptionText, confirmText, clearText, dataURL, bgSrc, bgWidth, bgHeight])
|
|
88
|
+
|
|
89
|
+
useEffect(()=> {
|
|
90
|
+
if(webViewRef.current) {
|
|
91
|
+
webViewRef.current.reload();
|
|
92
|
+
} }, [source]);
|
|
93
|
+
|
|
89
94
|
const isJson = (str)=> {
|
|
90
95
|
try {
|
|
91
96
|
JSON.parse(str);
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-signature-canvas",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.1",
|
|
4
4
|
"description": "React Native Signature Component based Canvas for Android && IOS && expo",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"
|
|
7
|
+
"publish": "npm publish",
|
|
8
8
|
"genlog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
|
9
9
|
"postversion": "git push --follow-tags"
|
|
10
10
|
},
|
|
@@ -28,10 +28,7 @@
|
|
|
28
28
|
"url": "https://github.com/YanYuanFE/react-native-signature-canvas/issues"
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/YanYuanFE/react-native-signature-canvas#readme",
|
|
31
|
-
"devDependencies": {
|
|
32
|
-
"react-native-webview": "^11.0.3"
|
|
33
|
-
},
|
|
34
31
|
"peerDependencies": {
|
|
35
|
-
"react-native-webview": "
|
|
32
|
+
"react-native-webview": "11.18.1"
|
|
36
33
|
}
|
|
37
34
|
}
|