react-native-signature-canvas 5.0.0 → 5.0.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/h5/js/app.js CHANGED
@@ -8,7 +8,6 @@ export default `
8
8
 
9
9
  if (!wrapper || !canvas) {
10
10
  console.error('Required DOM elements not found');
11
- return;
12
11
  }
13
12
 
14
13
  // Enhanced canvas resize with debouncing
@@ -84,12 +83,6 @@ export default `
84
83
  return;
85
84
  }
86
85
 
87
- // Validate color format
88
- if (typeof color !== 'string' || (!color.match(/^#[0-9A-F]{6}$/i) && !color.match(/^rgba?\(/))) {
89
- console.warn('Invalid color format:', color);
90
- return;
91
- }
92
-
93
86
  signaturePad.penColor = color;
94
87
  window.ReactNativeWebView && window.ReactNativeWebView.postMessage("CHANGE_PEN");
95
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-signature-canvas",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "A performant, customizable React Native signature canvas with advanced error handling, WebView optimization, and TypeScript support for iOS, Android, and Expo",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/CLAUDE.md DELETED
@@ -1,88 +0,0 @@
1
- # CLAUDE.md
2
-
3
- This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
-
5
- ## Project Overview
6
-
7
- This is `react-native-signature-canvas`, a React Native library for capturing signatures and drawing on a canvas. The library provides a WebView-based signature pad component with smooth drawing capabilities across iOS, Android, and Expo.
8
-
9
- ## Core Architecture
10
-
11
- The library uses a hybrid architecture combining React Native and web technologies:
12
-
13
- - **Main Component** (`index.js`): The React Native component that wraps a WebView
14
- - **WebView Content** (`h5/`): HTML, CSS, and JavaScript that runs inside the WebView
15
- - `html.js`: HTML template with placeholder variables for configuration
16
- - `js/signature_pad.js`: Core signature pad functionality
17
- - `js/app.js`: Application logic for handling signature interactions
18
- - `css/signature-pad.css`: Styling for the signature pad interface
19
- - **TypeScript Definitions** (`index.d.ts`): Type definitions for props and ref methods
20
-
21
- ### Key Technical Details
22
-
23
- 1. **Communication**: React Native communicates with the WebView through:
24
- - `injectedJavaScript`: JavaScript code injected into the WebView
25
- - `onMessage`: Messages sent from WebView to React Native
26
- - Template variables in HTML (e.g., `<%penColor%>`, `<%bgSrc%>`)
27
-
28
- 2. **Signature Export**: Signatures are captured as base64 data URLs and passed back to React Native via the WebView message bridge
29
-
30
- 3. **Customization**: The component supports extensive customization through props that modify the injected HTML/CSS/JS
31
-
32
- ## Common Development Commands
33
-
34
- ### Example Apps
35
- The repository contains multiple example applications for different use cases:
36
-
37
- ```bash
38
- # React Native CLI app with TypeScript
39
- cd example/signapp && npm run android
40
- cd example/signapp && npm run ios
41
-
42
- # Expo app with modern Expo Router
43
- cd example/expo-app && npm start
44
- cd example/expo-app && npm run android
45
- cd example/expo-app && npm run ios
46
-
47
- # Basic React Native CLI app
48
- cd example/exampleApp && npm start
49
- ```
50
-
51
- ### Testing
52
- ```bash
53
- # Run tests in example apps
54
- cd example/signapp && npm test
55
- cd example/expo-app && npm test
56
- ```
57
-
58
- ### Linting
59
- ```bash
60
- # Lint example apps
61
- cd example/signapp && npm run lint
62
- cd example/expo-app && npm run lint
63
- ```
64
-
65
- ## Development Notes
66
-
67
- ### Modifying the Core Component
68
- - The main component logic is in `index.js`
69
- - WebView HTML template is in `h5/html.js`
70
- - JavaScript functionality is split between `h5/js/signature_pad.js` and `h5/js/app.js`
71
-
72
- ### Adding New Features
73
- 1. Add props to the main component interface
74
- 2. Update TypeScript definitions in `index.d.ts`
75
- 3. Modify the HTML template in `h5/html.js` if UI changes are needed
76
- 4. Update the injected JavaScript in `h5/js/app.js` for new functionality
77
- 5. Test across multiple example apps to ensure compatibility
78
-
79
- ### Example App Structure
80
- - `signapp/`: Full React Native CLI app with TypeScript and Jest testing
81
- - `expo-app/`: Modern Expo app with Expo Router and TypeScript
82
- - `exampleApp/`: Basic React Native CLI app
83
- - `expo-app1/`, `signapp1/`, `sign-app/`, `ts-expo/`: Various other example configurations
84
-
85
- ### Dependencies
86
- - Main library only has peer dependency on `react-native-webview`
87
- - Example apps include additional dependencies for testing and development
88
- - No build process required for the main library (it's a pure React Native component)