@@ -104,7 +104,7 @@ type MenuItemBaseProps = {
104104 descriptionTextStyle ?: StyleProp < TextStyle > ;
105105
106106 /** The fill color to pass into the icon. */
107- iconFill ?: string ;
107+ iconFill ?: string | ( ( isHovered : boolean ) => string ) ;
108108
109109 /** Secondary icon to display on the left side of component, right of the icon */
110110 secondaryIcon ?: IconAsset ;
@@ -377,6 +377,9 @@ type MenuItemBaseProps = {
377377
378378 /** Report ID for the avatar on the right */
379379 rightIconReportID ?: string ;
380+
381+ /** Whether the menu item contains nested submenu items. */
382+ hasSubMenuItems ?: boolean ;
380383} ;
381384
382385type MenuItemProps = ( IconProps | AvatarProps | NoIcon ) & MenuItemBaseProps ;
@@ -498,6 +501,7 @@ function MenuItem(
498501 shouldTeleportPortalToModalLayer,
499502 copyValue,
500503 plaidUrl,
504+ hasSubMenuItems = false ,
501505 } : MenuItemProps ,
502506 ref : PressableRef ,
503507) {
@@ -755,14 +759,17 @@ function MenuItem(
755759 width = { iconWidth }
756760 height = { iconHeight }
757761 fill = {
762+ // eslint-disable-next-line no-nested-ternary
758763 displayInDefaultIconColor
759764 ? undefined
760- : ( iconFill ??
761- StyleUtils . getIconFillColor (
762- getButtonState ( focused || isHovered , pressed , success , disabled , interactive ) ,
763- true ,
764- isPaneMenu ,
765- ) )
765+ : typeof iconFill === 'function'
766+ ? iconFill ( isHovered )
767+ : ( iconFill ??
768+ StyleUtils . getIconFillColor (
769+ getButtonState ( focused || isHovered , pressed , success , disabled , interactive ) ,
770+ true ,
771+ isPaneMenu ,
772+ ) )
766773 }
767774 additionalStyles = { additionalIconStyles }
768775 />
@@ -936,11 +943,15 @@ function MenuItem(
936943 styles . pointerEventsAuto ,
937944 StyleUtils . getMenuItemIconStyle ( isCompact ) ,
938945 disabled && ! shouldUseDefaultCursorWhenDisabled && styles . cursorDisabled ,
946+ hasSubMenuItems && styles . opacitySemiTransparent ,
947+ hasSubMenuItems && styles . pl6 ,
939948 ] }
940949 >
941950 < Icon
942951 src = { iconRight }
943952 fill = { StyleUtils . getIconFillColor ( getButtonState ( focused || isHovered , pressed , success , disabled , interactive ) ) }
953+ width = { hasSubMenuItems ? variables . iconSizeSmall : variables . iconSizeNormal }
954+ height = { hasSubMenuItems ? variables . iconSizeSmall : variables . iconSizeNormal }
944955 />
945956 </ View >
946957 ) }
0 commit comments