React 74.5: loading images from data: URIs fails on iOS 15, works on 18 #48494
Labels
Component: Image
Issue: Author Provided Repro
This issue can be reproduced in Snack or an attached project.
Newer Patch Available
Platform: iOS
iOS applications.
Description
I think this is related to: #42234
I tried reproducing it in the Expo Stack, but was not able to do it with the example on the website (https://reactnative.dev/docs/image#src). I can only presume this is because this happens in a native component.
Here is my code that is as close as possible to the error:
Basically what causes the problem is that on iOS 15 (iphone 6s) the data uri that is being loaded by the Image component receives a
.png
at the end and afile://
at the beginning. As seen here (this is the warning that is presented to me, I think it comes from the component)And this is the console output (note the warning text with the base64 encoded image data ending with
.png
, whereas the uri parameter given to theImage
component does not have it):On iOS 18 this behavior (adding png and file) does not get triggered.
Edit:
I did some digging, and the function that shows the
Could not find image warning
from the screenshot, which already contains the malformed URI, does not even get triggered on the newer iOS version. To test this, I adjusted the code for both locations where the error is triggered:and
For reference,
loadImageForURL
is the one getting triggered on iOS 15, and no logs are generated on iOS 18.Steps to reproduce
hand over data uri with base64 encoded image in <Image source={{ uri: image }}
React Native Version
0.74.5
Affected Platforms
Runtime - iOS
Output of
npx react-native info
Stacktrace or Logs
The text was updated successfully, but these errors were encountered: