diff --git a/src/components/SvgCapture.tsx b/src/components/SvgCapture.tsx index 1ea4630..88131ae 100644 --- a/src/components/SvgCapture.tsx +++ b/src/components/SvgCapture.tsx @@ -4,11 +4,14 @@ import { type LayoutChangeEvent, View, StyleSheet, + type ViewStyle, + type StyleProp, } from 'react-native'; import Svg, { G, Polyline } from 'react-native-svg'; type CaptureSignatureProps = { paths: number[][]; + canvasStyle?: StyleProp; handleOnTouchStart: (e: GestureResponderEvent) => void; handleOnTouchMove: (e: GestureResponderEvent) => void; handleLayout: (e: LayoutChangeEvent) => void; @@ -16,6 +19,7 @@ type CaptureSignatureProps = { const SvgCapture = ({ paths, + canvasStyle, handleOnTouchStart, handleOnTouchMove, handleLayout, @@ -23,7 +27,7 @@ const SvgCapture = ({ return ( { const handleSetLowestPoints = (x: number, y: number) => { if (x < lowestPoints.current.x) { - lowestPoints.current.x = y; + lowestPoints.current.x = x; } if (y < lowestPoints.current.y) { lowestPoints.current.y = y; @@ -90,9 +90,14 @@ const useSvgCapture = () => { `; }; - const getFilePath = () => { + const getSvgAsString = () => { const cleanedSvgPath = getCleanedSvgImage(); const svgString = pathsToSVG(cleanedSvgPath); + return svgString; + }; + + const getFilePath = async (): Promise => { + const svgString = getSvgAsString(); const svgBlob = svgStringToBlob(svgString); return svgBlob; }; @@ -104,6 +109,7 @@ const useSvgCapture = () => { handleLayout, clearPad, getFilePath, + getSvgAsString, }; };