Repository navigation
feat(appbar)!: read parts from context and add Expressive props - #5218
Conversation
Appbar no longer inspects and clones its children. Appbar.BackAction, Appbar.Content and Appbar.Action read dark, theme and mode from context, so they work when wrapped in other components such as Tooltip. Adds Material 3 Expressive support as props on the existing parts: - mode="medium-flexible" and mode="large-flexible" on Appbar and Appbar.Header, which grow with a title that wraps onto a second line - variant and width on Appbar.Action for filled, tonal and wide actions - isScrolled on Appbar and Appbar.Header for the on-scroll color The surface renders in flat mode so an animated style shows on iOS. The bottom bar keeps working and is deprecated until Toolbar lands. BREAKING CHANGE: Appbar renders its children in the order they are given instead of moving Appbar.BackAction and the actions with isLeading to the front. Appbar.Content always has a 12dp margin before its title, and its internal mode prop is removed. In the center-aligned mode, only Appbar.BackAction and actions with isLeading count as leading actions. Based on the work in #5075 by Paweł Kata. Co-Authored-By: Paweł Kata <pawel.kata@callstack.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Appbar no longer inspects and clones its children. Appbar.BackAction, Appbar.Content and Appbar.Action read dark, theme and mode from context, so they work when wrapped in other components such as Tooltip. Adds Material 3 Expressive support as props on the existing parts: - mode="medium-flexible" and mode="large-flexible" on Appbar and Appbar.Header, which grow with a title that wraps onto a second line - variant and width on Appbar.Action for filled, tonal and wide actions - isScrolled on Appbar and Appbar.Header for the on-scroll color The surface renders in flat mode so an animated style shows on iOS. The bottom bar keeps working and is deprecated until Toolbar lands. BREAKING CHANGE: Appbar renders its children in the order they are given instead of moving Appbar.BackAction and the actions with isLeading to the front. Appbar.Content always has a 12dp margin before its title, and its internal mode prop is removed. In the center-aligned mode, only Appbar.BackAction and actions with isLeading count as leading actions. Based on the work in #5075 by Paweł Kata. Co-Authored-By: Paweł Kata <pawel.kata@callstack.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…-improvements # Conflicts: # src/components/Appbar/utils.ts
# Conflicts: # docs/6.x/docs/guides/migration.md # src/components/Appbar/Appbar.tsx # src/components/Appbar/AppbarContent.tsx
- Center the title of the center-aligned mode from the measured width of the items around it, so actions without isLeading and custom children are counted, and no spacer pushes the actions - Call the onLayout of Appbar.Content and Appbar along with the Appbar's - Center the controls of every mode at the same height as small - Replace nested ternaries in Appbar.Action with a lookup - Say Appbar.Content has to be a direct child, add tests for wrapped actions, and document the layout, theme and center-aligned changes Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
/review |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 3 new findings on 8b87dc1. The verdict and the full list are in the summary comment.
A filled or tonal Appbar.Action is selected by default, but an explicitly passed selected was ignored, so a toggle could never show its off state. Default selected to true instead, document it, and cover both variants. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 3 new findings on 2a651e8. The verdict and the full list are in the summary comment.
- isLeading only selects the icon color now, say so in its doc and the migration guide - Say that only Appbar.BackAction, Appbar.Content and Appbar.Action read the colors and the theme of the Appbar, and that a Tooltip no longer gets its theme - Test that the Appbar forgets the layout of an Appbar.Content that unmounts in the flexible and center-aligned modes Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Doberjohn
left a comment
There was a problem hiding this comment.
Thanks Nikolay, most of this held up on Android, iOS and web, and the checks pass on the head and merged with main. Two blockers inline (RTL, and web centering), plus a few smaller notes.
This comment has been minimized.
This comment has been minimized.
- Measure the center-aligned title in RTL with the margins React Native swaps, so it settles instead of jumping. - Set the layout handlers in every mode, as the web only observes elements that have onLayout when they mount. - Merge the theme of a part over the theme of the Appbar. - Make the wide action 52 wide, as in Material 3. - Fix the icon offsets in the migration guide, mark the v6 props. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 079b70f. The verdict and the full list are in the summary comment.
Pin it with a test: elevated with isScrolled keeps the shadow and uses the surfaceContainer color, isScrolled alone has no shadow. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Apex Sentinel · ✅ Approve · review of
|
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
The 6.x migration guide gets the entries that were missing for the Dialog (#5072), FAB (#5110) and TextInput (#5111) changes. - Dialog: the Portal sample shows the 5.x form and the prop-based API section says `children` is gone. New sections cover `scrollable` in place of `Dialog.ScrollArea`, a function `icon` for the icon's color and size, plain views in place of `Dialog.Content` and `Dialog.Actions` outside a Dialog, and the layout changes. The actions row style has no replacement, and the guide says so. - FAB: what `visible={false}` now does, and that tests need `includeHiddenElements` to find a hidden FAB. - TextInput: a disabled field is always read-only. - Focus indicator: the Appbar sentence now says the parts read the bar's `theme` from context (#5218) and links to that section. Two notes for apps written against a 6.0 alpha cover the dialog's top spacing and the single dim of a disabled field; neither changes anything for 5.x users. Part of #4991.
Motivation
Per D7 in #5150,
Appbarkeeps its compound API in 6.0, built on context, with Expressive features as props. Replaces #5075 (credit @pawelkata); covers Appbar's part of #4989.dark,themeandmodefrom context instead ofcloneElement, so they work inside wrappers likeTooltip.modevaluesmedium-flexible/large-flexible,variant/widthonAppbar.Action, andisScrolled.styleon iOS.BREAKING CHANGE: children render in the given order (
isLeadingno longer reorders),Contentalways has a 12dp title margin, and itsmodeprop is removed.Screenshots / Videos
Test plan
In the example Appbar screen, cycle all modes, toggle Scrolled and Filled action, and check Tooltip and Menu headers.