jibon57 / nativescript-mediafilepicker

A complete file picker solution for NativeScript
Apache License 2.0
51 stars 39 forks source link

I am stuck in the /storage/emulated/0/DCIM/Screenshots folder when opening Customer File Picker #101

Closed tangerinegit closed 4 years ago

tangerinegit commented 4 years ago

I am testing with an Android physical device. Everything works well, except that I am stuck in the /storage/emulated/0/DCIM/Screenshots folder and I cannot navigate to any other folder.

How can I set the plugin to allow folder navigation?

Here is my code:

let extensions = [];

    if (page.ios) {
        //more types from here: https://developer.apple.com/documentation/mobilecoreservices/uttype/uti_image_content_types
        extensions = [kUTTypePDF, kUTTypeImage, kUTTypePNG, kUTTypeJPEG, kUTTypeContent]; 
    } else {
        extensions = ['pdf', 'doc', 'docx', 'jpg', 'jpeg', 'gif', 'png']; 
    }

    let options: media.FilePickerOptions = {
        android: {
            extensions: extensions,
            maxNumberFiles: 10
        },
        ios: {
            extensions: extensions,
            multipleSelection: true
        }
    };

    let mfp = new media.Mediafilepicker();
    mfp.openFilePicker(options)

    mfp.on("getFiles", function (res) {
        let results = res.object.get('results');
        let files: string[] = [];
        results.forEach((r: any) => {
            files.push(r.file);
        });
        console.dir(files); 
        model.set('files', files);
    });

    mfp.on("error", function (res) {
        let msg = res.object.get('msg');
        console.log(msg);
    });

    mfp.on("cancel", function (res) {
        let msg = res.object.get('msg');
        console.log(msg);
    });
jibon57 commented 4 years ago

Please open this issue in native repo. It can be nothing from this plugin.