-
Notifications
You must be signed in to change notification settings - Fork 14
Description
In my project, I use the nativescript-bitmap-factory (version 1,8.1) to crop an image:
public cropImage(image : ImageSource) : ImageSource {
let mutable = BitmapFactory.makeMutable(image);
return BitmapFactory.asBitmap(mutable).dispose((bmp) => {
let croppedImage = bmp.crop({x:10,y:10}, {width:300,height:300});
console.log("Image cropped!")
return croppedImage.toImageSource();
});
}
This works beautifully on Android emulators and devices, but throws the following exception on iPhone:
CONSOLE ERROR file:///app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:676:30: Unhandled Promise rejection: The method setNativeSource() expects UIImage instance. ; Zone: ; Task: Promise.then ; Value: Error: The method setNativeSource() expects UIImage instance. setNativeSource@file:///app/tns_modules/tns-core-modules/image-source/image-source.js:112:28 [angular]
toImageSource@file:///app/tns_modules/nativescript-bitmap-factory/BitmapFactory.commons.js:374:31 [angular]
dispose@file:///app/tns_modules/nativescript-bitmap-factory/BitmapFactory.commons.js:87:30 [angular]
......
onInvoke@file:///app/tns_modules/@angular/core/bundles/core.umd.js:17344:43 [angular]
file:///app/pages/capture-image/capture-image.component.js:64:30 []
file:///app/tns_modules/nativescript<\M-b\M^@\M-&>
Googled the error message found this:
mkloubert/nativescript-bitmap-factory#19
but there is no solution there.
Is there a fix? Thanks!