Skip to content

feature: leadingImageFit on list items - #116

Open
SRWieZ wants to merge 1 commit into
NativePHP:mainfrom
SRWieZ:feat/list-item-leading-image-fit
Open

SRWieZ wants to merge 1 commit into
NativePHP:mainfrom
SRWieZ:feat/list-item-leading-image-fit

Conversation

@SRWieZ

@SRWieZ SRWieZ commented Oct 3, 2026

Copy link
Copy Markdown
Member

What's wrong

A list item's leading image always fills its square and crops whatever doesn't fit. That's fine for photos, but a wide picture or a logo loses its edges.

What this does

A new opt-in leadingImageFit="contain" shows the whole image inside the square instead of cropping it. The default stays as it is today (fill and crop), so existing lists don't change. It reuses the image loading from #56 and only passes the fit along. iOS and Android.

How to reproduce

The same wide image twice.

  • Item A: cropped, as today.
  • Item B: shown whole.
// routes/mobile.php
Route::native('/repro/leading-image-fit', \App\NativeComponents\LeadingImageFit::class);
// app/NativeComponents/LeadingImageFit.php
namespace App\NativeComponents;

use Illuminate\View\View;
use Native\Mobile\Edge\NativeComponent;

class LeadingImageFit extends NativeComponent
{
    public function render(): View
    {
        return view('native.leading-image-fit');
    }
}
{{-- resources/views/native/leading-image-fit.blade.php --}}
<native:column class="w-full h-full bg-zinc-100">
    <native:top-bar title="Leading images" />
    <native:list>
        <native:list-item headline="Item A" supporting="default (cover)" leadingImage="https://picsum.photos/id/10/400/120" />
        <native:list-item headline="Item B" supporting="contain" leadingImage="https://picsum.photos/id/10/400/120" leadingImageFit="contain" />
    </native:list>
</native:column>

A list row's leading image always fills its 56pt square, cropping whatever
doesn't fit. leadingImageFit="contain" letterboxes instead, for artwork
whose aspect ratio carries the meaning (a wide illustration, a logo). The
default stays cover, so existing thumbnails are untouched.
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