-
Notifications
You must be signed in to change notification settings - Fork 336
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
Issue 328 ios fix image loading using uri or path #381
Issue 328 ios fix image loading using uri or path #381
Conversation
Use RCTConvert & RCTUmageLoader in order to load images correctly with path and uri
de607fc
to
8d707ac
Compare
README.md
Outdated
@@ -90,6 +95,9 @@ The promise resolves with an object containing: `path`, `uri`, `name`, `size` (b | |||
| keepMeta | If `true`, will attempt to preserve all file metadata/exif info, except the orientation value since the resizing also does rotation correction to the original image. Defaults to `false`, which means all metadata is lost. Note: This can only be `true` for `JPEG` images which are loaded from the file system (not Web). | | |||
| options.mode | Similar to [react-native Image's resizeMode](https://reactnative.dev/docs/image#resizemode): either `contain` (the default), `cover`, or `stretch`. `contain` will fit the image within `width` and `height`, preserving its ratio. `cover` preserves the aspect ratio, and makes sure the image is at least `width` wide or `height` tall. `stretch` will resize the image to exactly `width` and `height`. | | |||
| 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the alternative?
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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
8d707ac
to
78d4350
Compare
Problem
This fix the issue #328.
iOS was only accepted
uri
using schemefile://
. 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
;http://.....
);