Skip to content

Commit a3606c1

Browse files
committed
updated example and readme text
1 parent 95f4ea7 commit a3606c1

File tree

7 files changed

+11747
-6
lines changed

7 files changed

+11747
-6
lines changed

Example/ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ SPEC CHECKSUMS:
450450
React-jsi: 54245e1d5f4b690dec614a73a3795964eeef13a8
451451
React-jsiexecutor: 8ca588cc921e70590820ce72b8789b02c67cce38
452452
React-jsinspector: b14e62ebe7a66e9231e9581279909f2fc3db6606
453-
react-native-signature-capture: 331c29f07b4f19ccfe63c5247a956b203abb500f
453+
react-native-signature-capture: 6dae6c8c9f085536d4ba305e15c01f0a3a49373e
454454
React-RCTActionSheet: 910163b6b09685a35c4ebbc52b66d1bfbbe39fc5
455455
React-RCTAnimation: 9a883bbe1e9d2e158d4fb53765ed64c8dc2200c6
456456
React-RCTBlob: 39cf0ece1927996c4466510e25d2105f67010e13
@@ -466,4 +466,4 @@ SPEC CHECKSUMS:
466466

467467
PODFILE CHECKSUM: 4365f72b23e8a6c2053ba9ed30569fee4a87b00b
468468

469-
COCOAPODS: 1.9.3
469+
COCOAPODS: 1.9.1

Example/package-lock.json

Lines changed: 11661 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"dependencies": {
1313
"react": "16.13.1",
1414
"react-native": "0.63.2",
15-
"react-native-signature-capture": "^0.4.10"
15+
"react-native-signature-capture": "^0.4.11"
1616
},
1717
"devDependencies": {
1818
"@babel/core": "^7.8.4",
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import React, {Component} from 'react';
2+
import {View, Text, Modal, Platform} from 'react-native';
3+
import SignatureCapture from 'react-native-signature-capture';
4+
5+
const toolbarHeight = Platform.select({
6+
android: 0,
7+
ios: 22,
8+
});
9+
10+
const modalViewStyle = {
11+
paddingTop: toolbarHeight,
12+
flex: 1,
13+
};
14+
15+
class SignatureView extends Component {
16+
constructor(props) {
17+
super(props);
18+
19+
this.state = {
20+
visible: false,
21+
};
22+
}
23+
24+
show(display) {
25+
this.setState({visible: display});
26+
}
27+
28+
render() {
29+
const {visible} = this.state;
30+
31+
return (
32+
<Modal
33+
transparent={false}
34+
visible={visible}
35+
onRequestClose={this._onRequreClose.bind(this)}>
36+
<View style={modalViewStyle}>
37+
<View style={{padding: 10, flexDirection: 'row'}}>
38+
<Text onPress={this._onPressClose.bind(this)}>{' x '}</Text>
39+
<View style={{flex: 1, alignItems: 'center'}}>
40+
<Text style={{fontSize: 14}}>Please write your signature.</Text>
41+
</View>
42+
</View>
43+
<SignatureCapture
44+
style={{flex: 1, width: '100%'}}
45+
onDragEvent={this._onDragEvent.bind(this)}
46+
onSaveEvent={this._onSaveEvent.bind(this)}
47+
backgroundColor="#ff00ff"
48+
strokeColor="#ffffff"
49+
minStrokeWidth={4}
50+
maxStrokeWidth={4}
51+
/>
52+
</View>
53+
</Modal>
54+
);
55+
}
56+
57+
_onPressClose() {
58+
this.show(false);
59+
}
60+
61+
_onRequreClose() {
62+
this.show(false);
63+
}
64+
65+
_onDragEvent() {
66+
// This callback will be called when the user enters signature
67+
//console.log('dragged');
68+
}
69+
70+
_onSaveEvent(result) {
71+
//result.encoded - for the base64 encoded png
72+
//result.pathName - for the file path name
73+
this.props.onSave && this.props.onSave(result);
74+
}
75+
}
76+
77+
export default SignatureView;

Example/src/SignatureView.js renamed to Example/src/SignatureView.ios.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ class SignatureView extends Component {
4444
style={{flex: 1, width: '100%'}}
4545
onDragEvent={this._onDragEvent.bind(this)}
4646
onSaveEvent={this._onSaveEvent.bind(this)}
47-
backgroundColor='pink'
47+
backgroundColor="transparent"
48+
strokeColor="#000000"
4849
/>
4950
</View>
5051
</Modal>
@@ -61,7 +62,7 @@ class SignatureView extends Component {
6162

6263
_onDragEvent() {
6364
// This callback will be called when the user enters signature
64-
console.log('dragged');
65+
//console.log('dragged');
6566
}
6667

6768
_onSaveEvent(result) {

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ class RNSignatureExample extends Component {
175175
showTitleLabel={false}
176176
backgroundColor="#ff00ff"
177177
strokeColor="#ffffff"
178+
minStrokeWidth={4}
179+
maxStrokeWidth={4}
178180
viewMode={"portrait"}/>
179181
180182
<View style={{ flex: 1, flexDirection: "row" }}>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-signature-capture",
3-
"version": "0.4.10",
3+
"version": "0.4.11",
44
"description": "Lets users sign their signatures",
55
"main": "SignatureCapture.js",
66
"scripts": {

0 commit comments

Comments
 (0)