triniwiz / triniwiz/nativescript-plugins
[image-cache-it] src and fallback images with local (~/...) paths don't render in v8.0.1 (iOS)
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 87
- Forks
- 57
- Avg merge
- 1h 36m
- Merged PRs (30d)
- 4
Description
On iOS, local src or fallback images (e.g. ~/images/flags/flag.png) no longer render. Remote (http(s)://) URLs are unaffected. Works fine in v7.5.0 but not on 8.0.0 or 8.0.1. Android is fine. Environment: NativeScript 9.0.x
In index.ios.js, the ~/ branch of srcProperty.setNative assigns the resolved path string to nativeViewProtected.src, which doesn't seem to handle local paths. Going through setImageSource() instead loads the UIImage correctly, but it still doesn't render. The workaround (which seems to be ok) is to assign to this.imageSource:
if (src.startsWith('~/')) {
// this.nativeViewProtected.src = this.getFileName(src); // FAILS
this.imageSource = ImageSource.fromFileOrResourceSync(this.getFileName(src));
}
The same problem exists with fallback images.
Related: placeHolder and errorHolder are declared in common.ts and documented as iOS-supported, but 8.0.x has no code to handle them in iOS. Android still implements both.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in index.ios.js at srcProperty.setNative and inspect the ~/ path handling, then compare the Android implementation for fallback, placeHolder, and errorHolder. Check common.ts for the declared iOS-supported properties. Done means local src and fallback images render on iOS, and the documented placeholder and error images are handled there without regressing remote URLs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, javascript, typescript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100