Skip to content

Commit 2e1a2bd

Browse files
committed
chore: example
1 parent a4d64c5 commit 2e1a2bd

File tree

4 files changed

+34
-31
lines changed

4 files changed

+34
-31
lines changed

example/sign-app/App.js

+25-22
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ const Sign = ({ text, onOK }) => {
1313
const ref = useRef();
1414
const [bg, setBg] = useState(bgUrl);
1515

16+
const [, setIsScrollEnabled] = useState(false);
17+
1618
// Called after ref.current.readSignature() reads a non-empty base64 string
1719
const handleOK = (signature) => {
1820
console.log(signature);
@@ -39,33 +41,34 @@ const Sign = ({ text, onOK }) => {
3941
console.log(data);
4042
};
4143

44+
const signHeight = 500;
45+
46+
const height = 3;
47+
48+
49+
4250
return (
4351
<SignatureScreen
44-
onLoadEnd={() => {
45-
console.log('load end')
46-
}}
52+
onBegin={() => setIsScrollEnabled(false)}
53+
bgHeight={100}
54+
trimWhitespace={true}
55+
scrollable={false}
4756
ref={ref}
57+
onClear={handleClear}
58+
onEmpty={handleEmpty}
4859
onEnd={handleEnd}
4960
onOK={handleOK}
50-
onEmpty={handleEmpty}
51-
onClear={handleClear}
5261
onGetData={handleData}
53-
descriptionText={text}
54-
backgroundColor={'transparent'}
55-
style={{ flex: 1, height: 800 }}
56-
androidHardwareAccelerationDisabled={false}
62+
autoClear={false}
63+
style={{
64+
maxHeight: height * signHeight,
65+
overflow: "hidden",
66+
}}
67+
webviewContainerStyle={{
68+
maxHeight: height * signHeight,
69+
}}
5770
webStyle={`
58-
.m-signature-pad canvas {
59-
background-image: url('${bg}');
60-
background-size: 100% 100%;
61-
background-repeat: no-repeat;
62-
}
63-
.m-signature-pad {
64-
flex: 1;
65-
box-shadow: none;
66-
border-radius: 10px;
67-
height: 600px;
68-
}
71+
.m-signature-pad { max-Height: ${height} * ${signHeight}, margin:0px !important; overflow: hidden !important; background: white !important; border: none !important; border: 2px dashed #000; } .m-signature-pad--footer {display: none !important;}
6972
`}
7073
/>
7174
);
@@ -145,8 +148,8 @@ export default function App() {
145148
/>
146149
) : <Sign text="Test" onOK={(img) => {
147150
console.log('ok')
148-
setSign(img);
149-
onCapture();
151+
// setSign(img);
152+
// onCapture();
150153
}} />}
151154
</View>
152155
{/*</ImageBackground>*/}

example/sign-app/package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/sign-app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"expo-status-bar": "~1.11.1",
1414
"react": "18.2.0",
1515
"react-native": "0.73.2",
16-
"react-native-signature-canvas": "^4.7.1",
16+
"react-native-signature-canvas": "^4.7.2",
1717
"react-native-view-shot": "3.4.0",
1818
"react-native-webview": "^13.3.1"
1919
},

example/sign-app/pnpm-lock.yaml

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)