File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010var cameraModule = require ( "camera" ) ;
1111var icModule = require ( "nativescript-imagecropper" ) ;
1212
13- var _page ;
13+ var _page , _image1 ;
1414function pageLoaded ( args ) {
1515 _page = args . object ;
1616 // page.bindingContext = vmModule.mainViewModel;
17+ _image1 = _page . getViewById ( "image1" ) ;
1718}
1819exports . pageLoaded = pageLoaded ;
1920
@@ -23,6 +24,13 @@ exports.tapCameraAction = function(args){
2324 var cropper = new icModule . ImageCropper ( ) ;
2425 cropper . show ( picture ) . then ( function ( args ) {
2526 console . log ( JSON . stringify ( args ) ) ;
27+ if ( args . image !== null ) {
28+ _image1 . visibility = "visible" ;
29+ _image1 . imageSource = args . image ;
30+ }
31+ else {
32+ _image1 . visibility = "collapsed" ;
33+ }
2634 } )
2735 . catch ( function ( e ) {
2836 console . log ( e ) ;
@@ -38,6 +46,13 @@ exports.tapCameraActionResize = function(args){
3846 var cropper = new icModule . ImageCropper ( ) ;
3947 cropper . show ( picture , { width :100 , height :100 } ) . then ( function ( args ) {
4048 console . log ( JSON . stringify ( args ) ) ;
49+ if ( args . image !== null ) {
50+ _image1 . visibility = "visible" ;
51+ _image1 . imageSource = args . image ;
52+ }
53+ else {
54+ _image1 . visibility = "collapsed" ;
55+ }
4156 } )
4257 . catch ( function ( e ) {
4358 console . log ( e ) ;
Original file line number Diff line number Diff line change 33 <Label text =" nativescript-imagecropper demo" class =" title" textWrap =" true" />
44 <Button text =" Camera" tap =" tapCameraAction" />
55 <Button text =" Camera with Resize" tap =" tapCameraActionResize" />
6+ <Image id =" image1" visibility =" collapsed" />
67 </StackLayout >
78</Page >
Original file line number Diff line number Diff line change 11{
22 "name" :" nativescript-imagecropper" ,
3- "version" :" 0.0.3 " ,
3+ "version" :" 0.0.4 " ,
44 "description" :" A image cropper based on TOCropViewController for iOS and uCrop for Android" ,
55 "main" :" imagecropper.js" ,
66 "nativescript" :{
You can’t perform that action at this time.
0 commit comments