File tree Expand file tree Collapse file tree 4 files changed +23
-26
lines changed Expand file tree Collapse file tree 4 files changed +23
-26
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ You can use this component to capture really anything you want that can be drawn
7
7
8
8
## WARNING - iOS is in development and should be available soon. ANDROID ONLY for now.
9
9
10
- #### Platform controls used :
10
+ #### Native Libraries :
11
11
Android | iOS
12
12
---------- | -----------
13
13
[ gcacace/android-signaturepad] ( https://github.com/gcacace/android-signaturepad ) | [ SignatureView] ( https://cocoapods.org/pods/SignatureView )
@@ -20,18 +20,18 @@ From your command prompt/termial go to your app's root folder and execute:
20
20
## Usage
21
21
#### XML:
22
22
``` XML
23
- <Page xmlns =" http://schemas.nativescript.org/tns.xsd"
24
- xmlns : DrawingPad =" nativescript-drawingpad" >
25
- <StackLayout >
26
- <DrawingPad : DrawingPad
27
- height =" 200"
28
- id =" drawingPad"
29
- penColor =" #ff4081"
30
- penWidth =" 3" />
23
+ <Page xmlns =" http://schemas.nativescript.org/tns.xsd" xmlns : DrawingPad =" nativescript-drawingpad" loaded =" pageLoaded" >
24
+ <ActionBar title =" NativeScript-DrawingPad" color =" #fff" backgroundColor =" #03A9F4" />
25
+ <ScrollView >
26
+ <StackLayout >
27
+
28
+ <DrawingPad : DrawingPad
29
+ height =" 400"
30
+ id =" drawingPad"
31
+ penColor =" #ff4081" penWidth =" 3" />
31
32
32
- <button text =" Get Drawing" tap =" getDrawingAsPic" />
33
- <button text =" Clear Drawing" tap =" clearUserDrawing" />
34
- </StackLayout >
33
+ </StackLayout >
34
+ </ScrollView >
35
35
</Page >
36
36
```
37
37
@@ -57,11 +57,7 @@ exports.getDrawingAsPic = getDrawingAsPic;
57
57
// If you want to clear the signature/drawing...
58
58
function clearUserDrawing (args ) {
59
59
var pad = frame .topmost ().currentPage .getViewById (" drawingPad" );
60
- pad .clearDrawing ().then (function () {
61
- console .log (' DrawingPad cleared.' );
62
- }, function (err ) {
63
- console .log (err);
64
- });
60
+ pad .clearDrawing ();
65
61
}
66
62
exports .clearUserDrawing = clearUserDrawing;
67
63
```
Original file line number Diff line number Diff line change 1
1
<Page xmlns =" http://schemas.nativescript.org/tns.xsd" xmlns : DrawingPad =" nativescript-drawingpad" loaded =" pageLoaded" >
2
- <Page .actionBar>
3
- <ActionBar title =" NativeScript-DrawingPad" color =" #fff" backgroundColor =" #03A9F4" />
4
- </Page .actionBar>
2
+ <ActionBar title =" NativeScript-DrawingPad" color =" #fff" backgroundColor =" #03A9F4" />
5
3
<ScrollView >
6
4
<StackLayout >
7
5
8
- <DrawingPad : DrawingPad backgroundColor =" black"
9
- margin =" 10" height =" 300" id =" drawingPad"
6
+ <DrawingPad : DrawingPad
7
+ backgroundColor =" black"
8
+ margin =" 10" height =" 400"
9
+ id =" drawingPad"
10
10
penColor =" #ff4081" penWidth =" 3" />
11
11
12
12
<StackLayout orientation =" horizontal" >
13
- <Button text =" Get Drawing" color = " green " tap =" getMyDrawing" />
14
- <button text =" Clear Drawing" color = " red " tap =" clearMyDrawing" />
13
+ <Button text =" Get Drawing" tap =" getMyDrawing" />
14
+ <button text =" Clear Drawing" tap =" clearMyDrawing" />
15
15
</StackLayout >
16
16
</StackLayout >
17
17
</ScrollView >
Original file line number Diff line number Diff line change @@ -35,7 +35,8 @@ export class DrawingPad extends common.DrawingPad {
35
35
return new Promise ( ( resolve , reject ) => {
36
36
try {
37
37
if ( ! this . _android . isEmpty ( ) ) {
38
- resolve ( this . _android . getTransparentSignatureBitmap ( ) ) ;
38
+ let data = this . _android . getTransparentSignatureBitmap ( ) ;
39
+ resolve ( data ) ;
39
40
} else {
40
41
reject ( "DrawingPad is empty." ) ;
41
42
}
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ export class DrawingPad extends common.DrawingPad {
52
52
public getDrawing ( ) :Promise < any > {
53
53
return new Promise ( ( resolve , reject ) => {
54
54
try {
55
- var data = this . _ios . signatureData ( ) ;
55
+ let data = this . _ios . signatureData ( ) ;
56
56
resolve ( data ) ;
57
57
} catch ( err ) {
58
58
reject ( err ) ;
You can’t perform that action at this time.
0 commit comments