Closed xpalacincreditoh closed 2 years ago
When call openFilePicker console return: Error in v-on handler: "TypeError: Cannot read property 'then' of undefined"
My SelectModal.vue:
openPicker(item) { switch (item.key) { case 'photo': this.mediaService.showCameraPicker().then((files) => { item.files = files; this.$modal.close(item); }); break; case 'gallery': this.mediaService.showGalleryPicker().then((files) => { item.files = files; this.$modal.close(item); }); break; case 'file': this.mediaService.showFilePicker().then((files) => { item.files = files; this.$modal.close(item); }); break; default: this.$modal.close(item); break; } },
My MediaService.js:
import { openFilePicker } from '@nativescript-community/ui-document-picker'; export default class MediaService { showCameraPicker() { openFilePicker({ extensions: ['jpg'], multipleSelection: true, }); } showGalleryPicker() { openFilePicker({ extensions: ['jpg'], multipleSelection: true, }); } showFilePicker() { openFilePicker({ extensions: ['pdf'], multipleSelection: true, }); } }
@xpalacincreditoh your code is false you dont return a promise. Please this is a place to report bugs on the plugin
When call openFilePicker console return: Error in v-on handler: "TypeError: Cannot read property 'then' of undefined"
My SelectModal.vue:
My MediaService.js: