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
77
88## WARNING - iOS is in development and should be available soon. ANDROID ONLY for now.
99
10- #### Platform controls used :
10+ #### Native Libraries :
1111Android | iOS
1212---------- | -----------
1313[ 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:
2020## Usage
2121#### XML:
2222``` 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" />
3132
32- <button text =" Get Drawing" tap =" getDrawingAsPic" />
33- <button text =" Clear Drawing" tap =" clearUserDrawing" />
34- </StackLayout >
33+ </StackLayout >
34+ </ScrollView >
3535</Page >
3636```
3737
@@ -57,11 +57,7 @@ exports.getDrawingAsPic = getDrawingAsPic;
5757// If you want to clear the signature/drawing...
5858function clearUserDrawing (args ) {
5959 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 ();
6561}
6662exports .clearUserDrawing = clearUserDrawing;
6763```
Original file line number Diff line number Diff line change 11<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" />
53 <ScrollView >
64 <StackLayout >
75
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"
1010 penColor =" #ff4081" penWidth =" 3" />
1111
1212 <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" />
1515 </StackLayout >
1616 </StackLayout >
1717 </ScrollView >
Original file line number Diff line number Diff line change @@ -35,7 +35,8 @@ export class DrawingPad extends common.DrawingPad {
3535 return new Promise ( ( resolve , reject ) => {
3636 try {
3737 if ( ! this . _android . isEmpty ( ) ) {
38- resolve ( this . _android . getTransparentSignatureBitmap ( ) ) ;
38+ let data = this . _android . getTransparentSignatureBitmap ( ) ;
39+ resolve ( data ) ;
3940 } else {
4041 reject ( "DrawingPad is empty." ) ;
4142 }
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ export class DrawingPad extends common.DrawingPad {
5252 public getDrawing ( ) :Promise < any > {
5353 return new Promise ( ( resolve , reject ) => {
5454 try {
55- var data = this . _ios . signatureData ( ) ;
55+ let data = this . _ios . signatureData ( ) ;
5656 resolve ( data ) ;
5757 } catch ( err ) {
5858 reject ( err ) ;
You can’t perform that action at this time.
0 commit comments