1
votes

Using MediaFilePicker exactly as documented after fresh install I get JS Console Error:

Class constructor Observable cannot be invoked without 'new'

Tried to follow the instructions on this pagehttps://market.nativescript.org/plugins/nativescript-mediafilepicker/

But I get two errors:

first error:

The call is a simple button referring to onSelectImageTap

onSelectImageTap() {
        let mediafilepicker = new Mediafilepicker();
        mediafilepicker.openImagePicker(this.options);

        mediafilepicker.on("getFiles", function (res) {
            let results = res.object.get('results');
            console.dir(results);
        });
    } 

At line 1 of that call I get Class constructor Observable cannot be invoked without 'new' error?

Later, the .on() call in VS Code gives me an error indication saying that 'on' is not a function.

As far as I can see I do everything as per the instructions? Any hints?

1
Did you find any solution? I am having same problem - Christopher Kikoti

1 Answers

0
votes

I had the same issue, this is how I resolved the issue: I was using version ^3.x.x of MediaFilePicker with NS 8.x.x Changing to version ^4.x.x on MediaFilePicker in package.json and doing npm install resolved the issue for me. PS: Replace the "x" with actual digits e.g. 4.0.2