PeterStaev / nativescript-photo-editor

🎨 Easily edit an image in your NativeScript app (crop, draw, etc)
Apache License 2.0
47 stars 15 forks source link

TypeError: Cannot read property 'photoeditor' of undefined #15

Closed JasonMan34 closed 5 years ago

JasonMan34 commented 5 years ago

When trying to use the module, it doesn't work and the error message I get is TypeError: Cannot read property 'photoeditor' of undefined

The (relevant) code:

import {PhotoEditor, PhotoEditorControl} from "../nativescript-photo-editor";
import {fromFileOrResource} from "image-source";

let image = fromFileOrResource(this.imagePath); // "/storage/.../IMG-0001.jpg"

const photoEditor = new PhotoEditor();
photoEditor.editPhoto({
    imageSource: image
})
.then(newImage => {
    console.log(newImage);
    // resultImage.imageSource = newImage;
})
.catch(e => {
    console.error(e);
});
PeterStaev commented 5 years ago

Hey @JasonMan34 , your import paths are a bit strange as they are relative. Please take a look at the attached demo in this repo and also take a look at the Readme to see how to use the plugin.

PeterStaev commented 5 years ago

No further response so closing this one for now. In case you still have problems, please provide more details.