Repository navigation
feat: opt-in image prop on top-bar actions - #537
Open
prosenthal828 wants to merge 1 commit into
Open
prosenthal828 wants to merge 1 commit into
prosenthal828 wants to merge 1 commit into
Conversation
Top-bar actions could only draw an icon, so apps had no native way to put the signed-in user's avatar on the profile action, the most common top-right control in tab apps. `image` takes a URL and draws it as a 28pt circle in place of the icon: Android uses Coil's AsyncImage (already a core dependency), iOS uses AsyncImage, matching NativeAsyncImage. The icon is drawn first and stays visible while the image loads and when it fails, so a bad URL degrades to today's behavior. Disabled actions fade the image too. Menu triggers honor it. NavAction gains a fluent ->image(), which treats null/blank as no image so `->image($user->avatarUrl ?? '')` just works. Unset keeps today's behavior everywhere. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Top-bar actions can only draw an icon. Tab apps very often put the signed-in user's avatar in the top-right, on the profile action, and today there is no native way to do that. Apps either settle for a generic
personicon or patch the renderers.This adds an opt-in
imageprop that takes a URL:Behavior
disabledfades the image too: 0.38 alpha on Android, matching M3's disabled tone, and the existing 0.4 opacity on iOS.->items([...])).imageis unset, everything renders exactly as it does today.Implementation
TopBarActionacceptsimage.NavAction::image(?string $url)treats null or blank as unset, so->image($maybeNull ?? '')needs noif.TopBarActionGlyphcomposable used byTopBarActionView, so it covers both the stack and the tabs top bar. It uses Coil 3'sAsyncImage, which is already a core dependency, so nothing new is added.TopBarActionGlyphview used by bothNativeRootStackRendererandTabsActionView. It uses SwiftUIAsyncImage, likeNativeAsyncImage. The caller's.font,.foregroundColorand.opacitystill reach the SF Symbol fallback.Tests
tests/Unit/Edge/TopBarActionImageTest.phpcovers: serialization, omitted when unset, the fluent builder keeping its icon fallback, null/blank treated as unset, and a laterimage(null)clearing an earlier image.:app:compileReleaseKotlin).Happy to add docs for the new prop wherever you'd like them.
🤖 Generated with Claude Code