Skip to content

Conversation

@gh-clement-taboulot
Copy link
Contributor

@gh-clement-taboulot gh-clement-taboulot commented Aug 21, 2023

Problem

This fix the issue #328.
iOS was only accepted uriusing scheme file://. This is a regression from version < 3.x.x.

Solution

The solution was to use the React-Native url converter & image loader in order to handle both path & uri (with several protocol/scheme).

Test

This PR also add several image sources in the example application using:

  • react-native-image-picker;
  • react-native-vision-camera;
  • @react-native-camera-roll/camera-roll;
  • simple url (i.e. http://.....);
ios android
New arch OFF https://github.com/bamlab/react-native-image-resizer/assets/9041221/2813ed1c-7929-45f1-9464-336a24f989c0 https://github.com/bamlab/react-native-image-resizer/assets/9041221/c519f3b9-e297-45e0-bd8b-1e6bbfe13c39
New arch ON https://github.com/bamlab/react-native-image-resizer/assets/9041221/cdd72618-9cca-44ac-a9b0-8cd2a92fd768 https://github.com/bamlab/react-native-image-resizer/assets/9041221/4b2c5f8a-3edd-4ad0-81f9-6c4daa9d4d5f

@gh-clement-taboulot gh-clement-taboulot force-pushed the issue-328-ios-fix-image-loading-using-uri-or-path branch from de607fc to 8d707ac Compare August 21, 2023 15:45
@gh-clement-taboulot gh-clement-taboulot marked this pull request as ready for review August 21, 2023 15:45
README.md Outdated
| options.onlyScaleDown | If `true`, will never enlarge the image, and will only make it smaller. |
# Limitations

- If you are using `@react-native-camera-roll/camera-roll` **with new architecture enabled this library is not going to work**. If you try to display an image with the `uri` of the library using `<Image />` you are going to have the following error: `No suitable image URL loader found for ph://...`. This error come from the ReactNative `ImageLoader`, which is the one we are currently using. Help/PR for solving this are welcome.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the alternative?

Copy link
Contributor Author

@gh-clement-taboulot gh-clement-taboulot Aug 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment using react-native-image-picker.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inside @react-native-camera-roll/camera-roll you have a util method that permit to load ph images and convert them into local images

@jcalixte jcalixte self-requested a review August 22, 2023 08:31
@gh-clement-taboulot gh-clement-taboulot force-pushed the issue-328-ios-fix-image-loading-using-uri-or-path branch from 8d707ac to 78d4350 Compare August 22, 2023 08:35
@gh-clement-taboulot gh-clement-taboulot added this to the 3.0.6 milestone Aug 22, 2023
@gh-clement-taboulot gh-clement-taboulot merged commit bb04979 into master Aug 22, 2023
@gh-clement-taboulot gh-clement-taboulot deleted the issue-328-ios-fix-image-loading-using-uri-or-path branch August 22, 2023 08:38
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

Successfully merging this pull request may close these issues.

4 participants