Open roge530 opened 6 months ago
Hello, thank you for the PR. Can you share a little more information about what android you tested this with?
I think if we just merge this change, it will work better for some people, but it will stop working for some other people, so I'd like to find something that works for everyone. Thank you 🙂
Of course, on the next days I will upload some test with different versions of android, can you provide me with a range?
Well, the more the better 🙂😄. But I was also wondering what device you have experienced the issue with, I'm curious. Thank you! 🙂
Here are the details of the device
I´ve been bussy lately, I´m sorry for taking this long to answer
hello @roge530 and thank you for your patience,
could you make the changes so that mimeTypes.csv
actually maps to both text/csv
and also text/comma-separated-values
?
I guess one way to do it is to allow for mimeTypes
to be a string, but also array of strings, and in this case the value would be ['text/csv', 'text/comma-separated-values']
. Does that make sense?
The first value is the "standard" one but apparently google uses text/comma-separated-values. We should use both to make sure it works with both cases.
Thank you!
Resolve the issue on Android where .csv files cannot be selected On /src/fileTypes.ts on line 4 the current version on master says:
csv: 'text/csv',
and I replace for:
csv: 'text/comma-separated-values',
With this change is possible to read csv files on Android as it should be expected. This works because when reading a .csv file using allFiles then accessing to the "type" property it returns "text/comma-separated-values".
For testing I provide this screenshots
Before the fix
Here I show the screen where the user is suppose to select a csv file
Here the user sees the file explorer, in this case the Downloads folder where I have a csv file, the csv file is display on the right window of vscode for reference of the content. We can see is a valid csv file but the code on the center window using
const res: DocumentPickerResponse = await DocumentPicker.pickSingle({ type: [DocumentPicker.types.csv], });
Does not allows use to pick the csv file
After the fix
With the fix the csv file is allowed to be picked
As we see, the file is read properly and can be used on the app
This should only apply to android devices, the emulator uses API 33, Android 13.0 Tiramisu
I run yarn typescript with 0 issues
Here is the differences between my branch and main
README.md