Skip to content
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

'File not found' error if using Picker and Environment.DIRECTORY_PICTURES does not exist yet #1030

Closed
aldrenalangcao opened this issue Jun 10, 2019 · 2 comments

Comments

@aldrenalangcao
Copy link
Contributor

Version

  • react-native-image-crop-picker v0.24.1
  • react-native v0.57.8

Platform

Android 8 & 9
Observed on Samsung S9+, A6+

Scenario

Using openPicker() and setting width and height options set.

Problem devices turned out that Environment.DIRECTORY_PICTURES directory doesn't exist on disk.

Issue same as #283 but applies when using gallery picker only and only when compression enabled.

Expected behaviour

Using openPicker with width & height, expected to pick an image. Promise should resolve with image.

Actual behaviour

Throws a 'File not found' exception.

Stepping through code, error occurs here:

OutputStream os = new BufferedOutputStream(new FileOutputStream(resizeImageFile));

In our case /storage/emulated/0/Pictures doesn't exist.

Steps to reproduce

  1. Check value of Environment.DIRECTORY_PICTURES then remove that directory on the device.

  2. Call openPicker() and set width and height options.

  3. Pick an image from gallery.

@aldrenalangcao aldrenalangcao changed the title File not found error if using Picker and Environment.DIRECTORY_PICTURES does not exist yet 'File not found' error if using Picker and Environment.DIRECTORY_PICTURES does not exist yet Jun 10, 2019
@aldrenalangcao
Copy link
Contributor Author

Had a fix on this PR #1027

@aldrenalangcao
Copy link
Contributor Author

Merged the fix here #1027

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant