[Android] File size of 0 with Camera!
See original GitHub issueHallo,
i don’t anderstend. Your picker (^0.20.0) worked well on VW (Genomotion), but when i start app on Device (OnePlus One, CM13, Andriod 6.0.1) i can’t to upload pictures from Camera. I found only one difference:
on vm: fileSize:6249
on device: fileSize:0
i think this is the problem or not??
my options:
const options = { storageOptions: { skipBackup: true, path: 'images' }, allowsEditing: false };
response on device:
fileName: "image-81d70921-110b-44f6-8f46-056e2adbd5b4.jpg", fileSize: 0, path: "/storage/emulated/0/Pictures/image-81d70921-110b-44f6-8f46-056e2adbd5b4.jpg", type: "image/jpeg", uri: "file:///storage/emulated/0/Pictures/image-81d70921-110b-44f6-8f46-056e2adbd5b4.jpg"
Issue Analytics
- State:
- Created 7 years ago
- Comments:28 (6 by maintainers)
Top GitHub Comments
I’ve experienced the same issue with a OnePlus 3, and running some experiments with react-native-fs indicates that it takes around 8 seconds for the reported file size to go from 0 to the correct value, and trying to use the image in the interim (like posting it to a service via
fetch
) will fail.Whilst the delay seems very long (post-processing?), it could be mitigated with an effective
waitUntilSaved
, but I can’t get this option to work for me, so I just have to add an arbitrary delay or keep checking every second or so.@marcshilling I think this is the root of the problem, but I’m afraid I don’t have the Java skills to provide a PR which updates
waitUntilSaved
to delay the callback until the file has a size > 0. I hope this is helpful though.@richsilv same problem I was seeing. The uri returned in the response does not actually contain anything for somewhere between 500ms and 10s.
I’m not sure how to fix but I did find a (very hacky) workaround that may work for some people. Sadly it’s all in JS:
something like…