Skip to content

[Masterclass] Android: <native:image> ignores per-corner border radii (containers honour them) #355

Description

@shrutibalasawebdev

What were you trying to do?

Follow-up to #311 - per-corner radii now work on containers, but <native:image> still takes the uniform-only path on Android.

Giving an image the same asymmetric corner treatment as a chat bubble - three corners rounded, one squared off for the tail - using rounded-3xl rounded-br-none.

What happened?

Expected: <native:image> clips to the same shape a <native:column> does with identical classes, so per-corner radii work on images too.

Actual on Android: the image only ever applies a single uniform radius, so it can be all-rounded or all-square and nothing in between.

  • rounded-3xl rounded-br-none gives a sharp bottom-right on a <native:column> but a fully-rounded shape on a <native:image>.
  • rounded-tl-3xl rounded-tr-3xl renders the image completely square, since there's no uniform radius to fall back on.

iOS honours per-corner radii on images correctly, so this is Android-only.

Cause, from the source: containers build their shape via nodeShape(radius, props), which reads the per-corner values (radius_tl / tr / br / bl) and produces an asymmetric RoundedCornerShape. The image element instead goes through the uniform-only compatibility wrapper path in ComposeRenderers.kt and is clipped with RoundedCornerShape(style.borderRadius.dp), which discards the per-corner props.

How to reproduce the bug

Place a column and an image side by side with identical classes and compare the bottom-right corner on Android.

<native:row class="w-full p-4 gap-4">
    <native:column class="w-[200] h-[100] rounded-3xl rounded-br-none bg-red-300" />
    <native:image src="..." class="w-[200] h-[100] rounded-3xl rounded-br-none" />
</native:row>

On Android the column has a sharp bottom-right corner and the image is fully rounded. On iOS both have the sharp corner.

Debug Output

   INFO  NativePHP Mobile.  

+--------------------+----------+
| Package Version    | dev-main |
| PHP Version (Host) | 8.4.18   |
| OS                 | Darwin   |
| OS Version         | 25.5.0   |
| Embedded PHP       | 8.4.24   |
+--------------------+----------+

   INFO  Installed Plugins.  

+---------------------------------+----------+
| Package                         | Version  |
+---------------------------------+----------+
| nativephp/mobile-camera         | 1.0.4    |
| nativephp/mobile-secure-storage | 1.0.2    |
| nativephp/mobile-ui             | dev-main |
| nativephp/mobile-vibe           | 2.0.0    |
+---------------------------------+----------+

   INFO  Development Tools.  

+----------------+--------------------------------------+
| Xcode          | Xcode 26.5                           |
| Android Studio | Android Studio AndroidStudio2025.2.3 |
| Gradle         | Gradle 8.14.5                        |
| Java           | openjdk version "17.0.18" 2026-01-20 |
| CocoaPods      | CocoaPods 1.16.2                     |
+----------------+--------------------------------------+

Which operating systems have you seen this occur on?

macOS

Which platforms were you trying to build for?

Android (Emulator)

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions