Repository navigation
MenuItem decomposition - description text style
#102263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
roryabraham
merged 18 commits into
Expensify:main
from
software-mansion-labs:war-in/menuitem-decomposition-description-text-style
Oct 8, 2026
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
81a97a8
refactor: always add announcements to accessibility label
war-in 02044c3
refactor: migrate to MenuItem composable API
war-in 026b6a9
test: add accessibility tests
war-in 240d9f9
feat: split MenuItemIcon into separate narrow variant
war-in b775de9
refactor: migrate to the narrow icon
war-in 2958fdf
refactor: migrate MenuItems with `descriptionTextStyle`
war-in 0e527ba
refactor: migrate MenuItems with `shouldIconUseAutoWidthStyle`
war-in ce01a7b
Merge branch 'main' into war-in/menuitem-decomposition-description-te…
war-in e242924
chore: post-merge fixes
war-in f96ed56
chore: post-merge fixes
war-in 308e77b
Merge branch 'main' into war-in/menuitem-decomposition-description-te…
war-in d6144b1
fix: remove unused imports
war-in 7e2a9e3
Merge branch 'main' into war-in/menuitem-decomposition-description-te…
war-in 3be3e9f
fix: migrate MenuItemWithTopDescription to MenuItem
war-in 081e306
fix: add accessibility label
war-in 65812aa
refactor: use MenuItem.HelpText for attendee
war-in 11ad009
fix: move `DistanceCounter` back and apply correct padding
war-in 8eee50f
refactor: migrate plain `FormHelpMessage` to MenuItem.HelpText
war-in File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
21 changes: 21 additions & 0 deletions
21
src/components/MenuItem/leaves/leading/MenuItemIconNarrow.tsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
|
|
||
| import React from 'react'; | ||
|
|
||
| import type {MenuItemIconProps} from './base/BaseMenuItemIcon'; | ||
|
|
||
| import BaseMenuItemIcon from './base/BaseMenuItemIcon'; | ||
|
|
||
| /** An icon glyph that takes only its own width */ | ||
| function MenuItemIconNarrow({src}: MenuItemIconProps) { | ||
| const styles = useThemeStyles(); | ||
|
|
||
| return ( | ||
| <BaseMenuItemIcon | ||
| src={src} | ||
| style={[styles.popoverMenuIcon, styles.wAuto]} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| export default MenuItemIconNarrow; |
48 changes: 48 additions & 0 deletions
48
src/components/MenuItem/leaves/leading/base/BaseMenuItemIcon.tsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import Icon from '@components/Icon'; | ||
| import {useMenuItemConfig, useMenuItemInteraction} from '@components/MenuItem/MenuItemContext'; | ||
|
|
||
| import useStyleUtils from '@hooks/useStyleUtils'; | ||
|
|
||
| import getButtonState from '@libs/getButtonState'; | ||
|
|
||
| import type IconAsset from '@src/types/utils/IconAsset'; | ||
|
|
||
| import type {StyleProp, ViewStyle} from 'react-native'; | ||
|
|
||
| import React from 'react'; | ||
|
|
||
| type MenuItemIconProps = { | ||
| src: IconAsset; | ||
| }; | ||
|
|
||
| type BaseMenuItemIconProps = MenuItemIconProps & { | ||
| /** The slot the glyph sits in, which is all the icon leaves differ by */ | ||
| style: StyleProp<ViewStyle>; | ||
| }; | ||
|
|
||
| /** Base of the icon leaves: a glyph filled from the row's interaction state */ | ||
| function BaseMenuItemIcon({src, style}: BaseMenuItemIconProps) { | ||
| const StyleUtils = useStyleUtils(); | ||
| const {isDisabled, isInteractive} = useMenuItemConfig(); | ||
| const {isHovered, isPressed} = useMenuItemInteraction(); | ||
|
|
||
| const iconFill = StyleUtils.getIconFillColor({ | ||
| buttonState: getButtonState({isActive: isHovered, isPressed, isDisabled, isInteractive}), | ||
| isMenuIcon: true, | ||
| isPane: true, | ||
| }); | ||
|
|
||
| return ( | ||
| <Icon | ||
| contentFit="cover" | ||
| hovered={isHovered} | ||
| pressed={isPressed} | ||
| src={src} | ||
| fill={iconFill} | ||
| additionalStyles={style} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| export default BaseMenuItemIcon; | ||
| export type {MenuItemIconProps}; |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't get this conversion, is it to prevent conditional styling?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I split it so callers pick the width explicitly.
DistanceCounterneeds a narrow icon outside a compact popover, which the old leaf couldn't do