Skip to content

fix: Android images default to Fit when no object-* class is set - #63

Open
SRWieZ wants to merge 1 commit into
NativePHP:mainfrom
SRWieZ:fix/android-image-default-fit
Open

fix: Android images default to Fit when no object-* class is set#63
SRWieZ wants to merge 1 commit into
NativePHP:mainfrom
SRWieZ:fix/android-image-default-fit

Conversation

@SRWieZ

@SRWieZ SRWieZ commented Aug 23, 2026

Copy link
Copy Markdown
Member

Problem

native:image without an object-* class renders differently on each platform. The PHP Image element only emits fit when one is set, and the renderers disagree on the missing-prop default:

  • iOS resolveContentMode(0).fit
  • Android p.getInt("fit")0ContentScale.None

On Android the bitmap is painted at intrinsic size and center-cropped to the frame. A 1024×1024 logo in a w-10 h-10 box shows only a 40 dp patch from its middle.

iOS Android
whole logo scaled into the frame center crop of the source

Fix

p.getInt("fit", 1) — a missing prop now defaults to Fit, matching iOS. An explicit object-none still sends fit: 0 and keeps ContentScale.None; the other mappings are unchanged.

@SRWieZ SRWieZ changed the title Android: default image fit to Fit when no object-* class is set fix: Android images default to Fit when no object-* class is set 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