react-native-signature-canvas 4.6.0 → 4.7.0

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 CHANGED
@@ -51,37 +51,38 @@ import SignatureScreen from 'react-native-signature-canvas';
51
51
  ---
52
52
 
53
53
  | Prop | Type | Description |
54
- | :---------------------------------- | :--------: | :---------------------------------------------------------------------------------------------------------------------------------------------------- |
54
+ |:------------------------------------| :--------: |:------------------------------------------------------------------------------------------------------------------------------------------------------|
55
55
  | androidHardwareAccelerationDisabled | `boolean` | androidHardwareAccelerationDisabled for react-native-webview. Default is false |
56
56
  | autoClear | `boolean` | should auto clear the signature after clicking the Confirm button |
57
- | backgroundColor | `string` | default is "rgba(255,255,255,0)" (_transparent_), background color of the canvas |
57
+ | backgroundColor | `string` | default is "rgba(255,255,255,0)" (_transparent_), background color of the canvas |
58
58
  | bgHeight | `number` | height of the background image |
59
59
  | bgWidth | `number` | width of the background image |
60
- | bgSrc | `string` | background image source uri (_url_) |
60
+ | bgSrc | `string` | background image source uri (_url_) |
61
61
  | clearText | `string` | clear button text |
62
62
  | confirmText | `string` | save button text |
63
63
  | customHtml | `(injectedJavaScript: string) => string` | html string that lets you modify things like the layout or elements |
64
64
  | dataURL | `string` | default is "", Base64 string, draws saved signature from dataURL. |
65
65
  | descriptionText | `string` | description text for signature |
66
66
  | dotSize | `number` | radius of a single dot _(not stroke width)_ |
67
- | imageType | `string` | "image/png" (_default_), "image/jpeg"、"image/svg+xml", imageType of exported signature |
67
+ | imageType | `string` | "image/png" (_default_), "image/jpeg"、"image/svg+xml", imageType of exported signature |
68
68
  | minWidth | `number` | minimum width of a line. Defaults to 0.5 |
69
69
  | maxWidth | `number` | maximum width of a line. Defaults to 2.5 |
70
70
  | onOK | `function` | callback function after saving non-empty signature |
71
71
  | onEmpty | `function` | callback function after trying to save an empty signature |
72
72
  | onClear | `function` | callback function after clearing the signature |
73
- |onGetData|`function`|callback function when getData() is called
73
+ | onGetData |`function`| callback function when getData() is called
74
74
  | onBegin | `function` | callback function when a new stroke is started |
75
75
  | onEnd | `function` | callback function when the stroke has ended |
76
- | onUndo | `function` | callback function when undo() is called |
77
- | onRedo | `function` | callback function when redo() is called |
76
+ | onLoadEnd | `function` | callback function when the webview canvas load ended |
77
+ | onUndo | `function` | callback function when undo() is called |
78
+ | onRedo | `function` | callback function when redo() is called |
78
79
  | onDraw | `function` | callback function when drawing is enabled |
79
80
  | onErase | `function` | callback function when erasing is enabled |
80
- | onChangePenColor | `function` | callback function after changing the pen color |
81
- | onChangePenSize | `function` | callback function after changing the pen size
82
- |overlayHeight|`number`|height of the overlay image|
83
- |overlayWidth|`number`|width of the overlay image|
84
- |overlaySrc|`string`|overlay image source uri (url) _must be .png with a transparent background_
81
+ | onChangePenColor | `function` | callback function after changing the pen color |
82
+ | onChangePenSize | `function` | callback function after changing the pen size
83
+ | overlayHeight |`number`| height of the overlay image |
84
+ | overlayWidth |`number`| width of the overlay image |
85
+ | overlaySrc |`string`| overlay image source uri (url) _must be .png with a transparent background_
85
86
  | penColor | `string` | default is "black", color of pen |
86
87
  | rotated | `boolean` | rotate signature pad 90 degrees |
87
88
  | style | `object` | style of wrapper view |
package/index.d.ts CHANGED
@@ -36,6 +36,7 @@ declare module "react-native-signature-canvas" {
36
36
  onChangePenSize?: () => void;
37
37
  onBegin?: () => void;
38
38
  onEnd?: () => void;
39
+ onLoadEnd?: () => void;
39
40
  overlayHeight?: number;
40
41
  overlayWidth?: number;
41
42
  overlaySrc?: string;
package/index.js CHANGED
@@ -61,6 +61,7 @@ const SignatureView = forwardRef(
61
61
  onChangePenSize = () => {},
62
62
  onBegin = () => {},
63
63
  onEnd = () => {},
64
+ onLoadEnd = () => {},
64
65
  overlayHeight = 0,
65
66
  overlayWidth = 0,
66
67
  overlaySrc = null,
@@ -253,6 +254,11 @@ const SignatureView = forwardRef(
253
254
  const renderError = ({ nativeEvent }) =>
254
255
  console.warn("WebView error: ", nativeEvent);
255
256
 
257
+ const handleLoadEnd = () => {
258
+ setLoading(false);
259
+ onLoadEnd();
260
+ }
261
+
256
262
  return (
257
263
  <View style={[styles.webBg, style]}>
258
264
  <WebView
@@ -269,7 +275,7 @@ const SignatureView = forwardRef(
269
275
  onMessage={getSignature}
270
276
  javaScriptEnabled={true}
271
277
  onError={renderError}
272
- onLoadEnd={() => setLoading(false)}
278
+ onLoadEnd={handleLoadEnd}
273
279
  />
274
280
  {loading && (
275
281
  <View style={styles.loadingOverlayContainer}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-signature-canvas",
3
- "version": "4.6.0",
3
+ "version": "4.7.0",
4
4
  "description": "React Native Signature Component based Canvas for Android && IOS && expo",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -29,6 +29,6 @@
29
29
  },
30
30
  "homepage": "https://github.com/YanYuanFE/react-native-signature-canvas#readme",
31
31
  "peerDependencies": {
32
- "react-native-webview": ">13.3.1"
32
+ "react-native-webview": ">=13"
33
33
  }
34
34
  }