Image doesn't render from local path with no extension (iOS only)
还没有人认领这个 Issue。
- 主要语言
- C++
- 星标
- 127k
- 派生
- 25.3k
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 4
描述
Description
Reason is the file has no extension name when write to path! It doesn't master under iOS, not work under React native!
Remote url Image is loaded and stored using react-native-fs and named as Z23qdxp_348:
/var/mobile/Containers/Data/Application/500161AF-8D6A-4A97-B746-0D0E12421768/Library/Caches/Z23qdxp_348
Note: If the change image name to Z23qdxp_348.jpeg the image become visible. (Works even for jpg and png image formats).
Could to be related to #23844
Steps to reproduce
- Download remote image
- Save it without extension in fileUri variable.
- Render <Image source={{uri: fileUri}} onError={(error) => console.error(error)}>
- Result: No image if name does not have extension.
https://snack.expo.dev/@romick/local-ios-image-without-extension-issue-?platform=web
React Native Version
0.73.2
Affected Platforms
Runtime - iOS
Output of npx react-native info
info Fetching system and libraries information...
```text System: OS: macOS 14.2.1 CPU: (8) arm64 Apple M1 Memory: 79.34 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 18.17.1 path: /usr/local/bin/node Yarn: version: 1.22.19 path: ~/.yarn/bin/yarn npm: version: 9.6.7 path: /usr/local/bin/npm Watchman: version: 2023.11.27.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.14.3 path: /Users/user/.rvm/gems/ruby-3.2.1/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 23.2 - iOS 17.2 - macOS 14.2 - tvOS 17.2 - watchOS 10.2 Android SDK: API Levels: - "28" - "29" - "30" - "31" - "33" - "34" Build Tools: - 28.0.3 - 29.0.2 - 29.0.3 - 30.0.2 - 30.0.3 - 31.0.0 - 33.0.0 - 33.0.1 - 34.0.0 System Images: - android-28 | Google APIs ARM 64 v8a - android-28 | Google ARM64-V8a Play ARM 64 v8a - android-31 | Google APIs ARM 64 v8a - android-32 | Google Play ARM 64 v8a - android-34 | Google Play ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2022.3 AI-223.8836.35.2231.10811636 Xcode: version: 15.1/15C65 path: /usr/bin/xcodebuild Languages: Java: version: 17.0.9 path: /usr/bin/javac Ruby: version: 3.2.1 path: /Users/user/.rvm/rubies/ruby-3.2.1/bin/ruby npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: ^18.2.0 react-native: installed: 0.73.2 wanted: ^0.73.2 react-native-macos: Not Found npmGlobalPackages: "*react-native*": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: true newArchEnabled: false ```Stacktrace or Logs
Image onError return localized error message:
Не вдалося відкрити файл «Z23qdxp_348.png», бо такого файлу немає.
That means:
The file "Z23qdxp_348.png" could not be opened, because this file does not exist.
Reproducer
https://github.com/Liqiankun/react-native-image-no-extension
Screenshots and Videos
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
先从链接的复现示例和 <Image source={{uri: fileUri}}> 示例开始,然后比较 iOS 上带扩展名和不带扩展名的路径的行为。当保存在无扩展名本地路径中的图像能够在 iOS 上成功渲染,且不再出现报告的文件缺失错误时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- react-native
- 领域
- mobile
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100