react-native-image-crop-tools
react-native-image-crop-tools copied to clipboard
The crop doesn't work anymore after the initial crop
It happens recently after I increase the compiled SDK to 30 because of this issue. I am not sure whether it is the cause or not.
After that, whenever I tried to crop the image, the response that I got was like this
{"height": 332, "uri": "/data/user/0/id.oftheapp/cache/temp_file_.jpg", "width": 592}
.
If I am not mistaken, previously the response uri that I got started with file/:....
.
And now, whenever I crop another picture and access that picture from the onImageCrop
, I always got the first image that I cropped.
I don't get the same image everytime, this may be caused on your side due some sort of cache (FastImage).
That said, it seems like some things are a bit broken inside the lib now, and there's need of some small fixes. I think the change in URL is happening because with the new compile SDK the underyling CanHub library produces Content URI's that need to be translated to File URI's.
Proposed fixes:
- Make sure the library always returns uri's prefixed with
file://
by prepending it if it is missing after getting the file URI from the underlying library. Could be done in the JavaScript part of the module or the android part. - Generate unique urls by setting the second parameter of
getUriFilePath
to true in ImageCropViewManager#L35. This will help with cache busting
I might be able to take a swing at a PR if I find the time for it.
@hhunaid If I make a PR to address these issues will it be merged? I see two open PR's at the moment.