Closed t1amat9409 closed 2 years ago
@t1amat9409 sorry did not have the time to make a doc yet
const result = await openFilePicker({
//@ts-ignore
extensions: global.isIOS ? [kUTTypeData, kUTTypeContent, kUTTypeItem] : ['*/*'],
multipleSelection: false,
pickerMode: 0
});
Something like that so:
@farfromrefug ah, thanks man... Will try it out
@farfromrefug I think ["pdf", "doc"]
works well with this, instead of ["application/msword"]
@t1amat9409 you mean on android?
@farfromrefug my bad, I noticed after a while that all file are greyed out
The extensions filter is working only with one extension ["pdf"] or ["png"], but not with multiple extensions. Android API seems to have changed, and you need something like :
intent.putExtra(Intent.EXTRA_MIME_TYPES, acceptTypes);
I made a PR https://github.com/nativescript-community/ui-document-picker/pull/3 to fix the issue. It would be nice if you can review it, and merge this fix.
version 1.1.4 fix the issue.
This sample code work on ios and android. In android, you have to specify extension, android will find application mimetype related to the extension provided :
const options: FilePickerOptions = {
extensions : isIOS ? [kUTTypeJPEG, kUTTypePDF] : ['jpeg', 'pdf'],
multipleSelection: false
};
@alexist Awesome
@xpalacincreditoh Please stop spamming this github repo! If you have question github is not the place. You should use Nativescript discord. Github is only for issue reporting.
Also in the future please add details, and you can also add a few nice words like please
or thanks
...
@xpalacincreditoh Please stop spamming this github repo! If you have question github is not the place. You should use Nativescript discord. Github is only for issue reporting. Also in the future please add details, and you can also add a few nice words like
please
orthanks
...
Good morning,
I will try to query the errors this plugin gives me in NativeScript Discord. The question was very similar to others that were before mine.
Thanks @farfromrefug
Just a quick question.
Do I use mimetypes: eg.
["application/msword"]
OR use it like this['.doc', '.docx']?