Skip to content

Commit 7b79a61

Browse files
Merge pull request #8 from KeyValueSoftwareSystems/integrate-example-app
Integrate the package in the example app
2 parents 37c217c + 864c085 commit 7b79a61

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

example/src/App.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,34 @@
11
import * as React from 'react';
22

3-
import { StyleSheet, View, Text } from 'react-native';
3+
import { Button, StyleSheet, View } from 'react-native';
4+
import {
5+
SvgCapture,
6+
useSvgCapture,
7+
} from '@keyvaluesystems/react-native-scribble';
48

59
export default function App() {
10+
const signatureProps = useSvgCapture();
11+
const { clearPad } = signatureProps;
12+
613
return (
714
<View style={styles.container}>
8-
<Text>Example app</Text>
15+
<View style={styles.svgCaptureContainer}>
16+
<SvgCapture {...signatureProps} />
17+
</View>
18+
<Button title="Clear" onPress={clearPad} />
919
</View>
1020
);
1121
}
1222

1323
const styles = StyleSheet.create({
1424
container: {
1525
flex: 1,
16-
alignItems: 'center',
1726
justifyContent: 'center',
1827
},
28+
svgCaptureContainer: {
29+
width: '100%',
30+
height: '80%',
31+
},
1932
box: {
2033
width: 60,
2134
height: 60,

src/hooks/useSvgCapture.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const useSvgCapture = () => {
1818
const { locationX, locationY } = e.nativeEvent;
1919
handleSetLowestPoints(locationX, locationY);
2020
setPaths((prev) => {
21-
return [[locationX, locationY], ...prev];
21+
return [[locationX, locationY, locationX + 1, locationY + 1], ...prev];
2222
});
2323
}, []);
2424

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"compilerOptions": {
33
"rootDir": ".",
44
"paths": {
5-
"react-native-scribble": ["./src/index"]
5+
"@keyvaluesystems/react-native-scribble": ["./src/index"]
66
},
77
"allowUnreachableCode": false,
88
"allowUnusedLabels": false,

0 commit comments

Comments
 (0)