react-native-rectangle-doc-scanner 0.21.0 → 0.23.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.
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.Overlay = void 0;
37
37
  const react_1 = __importStar(require("react"));
38
+ const react_native_1 = require("react-native");
38
39
  const react_native_skia_1 = require("@shopify/react-native-skia");
39
40
  const Overlay = ({ quad, color = '#e7a649' }) => {
40
41
  const path = (0, react_1.useMemo)(() => {
@@ -46,13 +47,29 @@ const Overlay = ({ quad, color = '#e7a649' }) => {
46
47
  }
47
48
  if (__DEV__) {
48
49
  console.log('[Overlay] drawing quad:', quad);
50
+ console.log('[Overlay] color:', color);
49
51
  }
50
52
  const skPath = react_native_skia_1.Skia.Path.Make();
51
53
  skPath.moveTo(quad[0].x, quad[0].y);
52
54
  quad.slice(1).forEach((p) => skPath.lineTo(p.x, p.y));
53
55
  skPath.close();
54
56
  return skPath;
55
- }, [quad]);
56
- return (react_1.default.createElement(react_native_skia_1.Canvas, { style: { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 } }, path && react_1.default.createElement(react_native_skia_1.Path, { path: path, color: color, style: "stroke", strokeWidth: 4 })));
57
+ }, [quad, color]);
58
+ return (react_1.default.createElement(react_native_1.View, { style: styles.container, pointerEvents: "none" },
59
+ react_1.default.createElement(react_native_skia_1.Canvas, { style: styles.canvas }, path && (react_1.default.createElement(react_1.default.Fragment, null,
60
+ react_1.default.createElement(react_native_skia_1.Path, { path: path, color: color, style: "stroke", strokeWidth: 8 }),
61
+ react_1.default.createElement(react_native_skia_1.Path, { path: path, color: "rgba(231, 166, 73, 0.2)", style: "fill" }))))));
57
62
  };
58
63
  exports.Overlay = Overlay;
64
+ const styles = react_native_1.StyleSheet.create({
65
+ container: {
66
+ position: 'absolute',
67
+ top: 0,
68
+ left: 0,
69
+ right: 0,
70
+ bottom: 0,
71
+ },
72
+ canvas: {
73
+ flex: 1,
74
+ },
75
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "0.21.0",
3
+ "version": "0.23.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {
@@ -1,4 +1,5 @@
1
1
  import React, { useMemo } from 'react';
2
+ import { View, StyleSheet } from 'react-native';
2
3
  import { Canvas, Path, Skia } from '@shopify/react-native-skia';
3
4
  import type { Point } from '../types';
4
5
 
@@ -18,6 +19,7 @@ export const Overlay: React.FC<OverlayProps> = ({ quad, color = '#e7a649' }) =>
18
19
 
19
20
  if (__DEV__) {
20
21
  console.log('[Overlay] drawing quad:', quad);
22
+ console.log('[Overlay] color:', color);
21
23
  }
22
24
 
23
25
  const skPath = Skia.Path.Make();
@@ -25,11 +27,31 @@ export const Overlay: React.FC<OverlayProps> = ({ quad, color = '#e7a649' }) =>
25
27
  quad.slice(1).forEach((p) => skPath.lineTo(p.x, p.y));
26
28
  skPath.close();
27
29
  return skPath;
28
- }, [quad]);
30
+ }, [quad, color]);
29
31
 
30
32
  return (
31
- <Canvas style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>
32
- {path && <Path path={path} color={color} style="stroke" strokeWidth={4} />}
33
- </Canvas>
33
+ <View style={styles.container} pointerEvents="none">
34
+ <Canvas style={styles.canvas}>
35
+ {path && (
36
+ <>
37
+ <Path path={path} color={color} style="stroke" strokeWidth={8} />
38
+ <Path path={path} color="rgba(231, 166, 73, 0.2)" style="fill" />
39
+ </>
40
+ )}
41
+ </Canvas>
42
+ </View>
34
43
  );
35
44
  };
45
+
46
+ const styles = StyleSheet.create({
47
+ container: {
48
+ position: 'absolute',
49
+ top: 0,
50
+ left: 0,
51
+ right: 0,
52
+ bottom: 0,
53
+ },
54
+ canvas: {
55
+ flex: 1,
56
+ },
57
+ });