react-native-documents / document-picker

Document Picker for React Native
https://react-native-documents.github.io/
MIT License
1.35k stars 437 forks source link

fix: intent type not set in case of multiple mime types filter #557

Closed Protino closed 2 years ago

Protino commented 2 years ago

Summary

This PR fixes issue #513, where even after restricting file types the user could choose any file type (only in case of multiple types)

This is fixed by calling setType on ACTION_GET_CONTENT intent with provided mimeTypes separated by |

Test Plan

What's required for testing (prerequisites)?

The example application is sufficient, provided the emulator/device has some example .doc and .png files

What are the steps to reproduce (after prerequisites)?

Steps to reproduce the issue -

Steps to verify the fix - Re-run the app with this commit merged, will only be able to select restricted file types.

Compatibility

OS Implemented
iOS
Android

Checklist

vonovak commented 2 years ago

thank you for the PR and sorry for taking so long, I needed to do https://github.com/rnmods/react-native-document-picker/commit/66efeab9774db3dcec16b13b8e987399880b5f35 first to be able to test it out :)

caijiami commented 2 years ago

@vonovak @Protino I have updated 8.1.1 and I still have all the files in Android. I only want PDF and docx, but the file selector still has APK, text and other files