Skip to content

fix(iOS): load leading images from plain file paths on iOS list items - #73

Open
SRWieZ wants to merge 1 commit into
NativePHP:mainfrom
SRWieZ:fix/list-item-leading-local-images
Open

fix(iOS): load leading images from plain file paths on iOS list items#73
SRWieZ wants to merge 1 commit into
NativePHP:mainfrom
SRWieZ:fix/list-item-leading-local-images

Conversation

@SRWieZ

@SRWieZ SRWieZ commented Aug 24, 2026

Copy link
Copy Markdown
Member

The bug

Give a list item a leading image that lives on the device:

<native:list-item headline="Yaniv" leadingImage="{{ public_path('yaniv-art.png') }}" />

On Android you get the image. On iOS you get a grey placeholder, forever. file:// and https:// sources are
fine — it's the plain path that dead-ends.

That's the shape most PHP sources have: public_path(), storage_path(), and the paths the camera and file
pickers hand back. <native:image> already accepts them, so today the same string renders in one element and
silently fails in the other.

Why

Both leading slots resolve their source through AsyncImage alone:

AsyncImage(url: URL(string: value)) {  }

URL(string: "/var/…/photo.png") has no scheme, so URLSession has nothing to fetch and the placeholder never
goes away.

The fix

Decode local sources with UIImage(contentsOfFile:) — exactly what NativeUIImageRenderer already does — and
keep AsyncImage for remote URLs. Applied to both the image and avatar slots, since an avatar is just as
likely to be a file the app just saved.

The "is this local?" check moves into a shared NativeUILocalImage, so the two renderers can't drift on the
answer.

iOS only — Android's Coil takes a path as-is. No PHP or wire changes, and nothing that renders today changes:
only sources that showed a placeholder start showing an image.

Before / after (iPhone 17 simulator, iOS 26, same Blade)

A list row's leading image and avatar both resolve their source through
AsyncImage alone. `URL(string:)` on a bare absolute path yields a URL with no
scheme, URLSession has nothing to fetch, and the row keeps its placeholder
forever. file:// and http(s) sources were unaffected.

Plain absolute paths are what the PHP side hands over — public_path(),
storage_path(), and the paths returned by the camera and file pickers — and
the <image> element already decodes them via UIImage(contentsOfFile:). The
same string therefore rendered in <image> and silently failed in
<list-item leadingImage="…">.

Decode local sources directly in both leading slots and keep AsyncImage for
remote URLs. The local-source check moves into NativeUILocalImage so the two
renderers cannot drift on what counts as local.
@SRWieZ SRWieZ changed the title iOS: load leading list images from plain filesystem paths fix: load leading images from plain file paths on iOS list items Aug 24, 2026
@SRWieZ SRWieZ changed the title fix: load leading images from plain file paths on iOS list items fix(iOS): load leading images from plain file paths on iOS list items Aug 24, 2026
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.

1 participant