-
-
Notifications
You must be signed in to change notification settings - Fork 441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: .CSV files cannot be selected on Android using the type csv #695
base: master
Are you sure you want to change the base?
Conversation
Resolve the issue on Android where .csv files cannot be selected
Hello, 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. |
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 🙂😄. |
hello @roge530 and thank you for your patience, I guess one way to do it is to allow for 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! |
That fixes it for me |
I´ll try this tomorrow |
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