1+ import { Box , Column , DropdownMenu , Row , Host , RNHostView , Text } from "@expo/ui/jetpack-compose" ;
12import {
2- Box ,
3- Column ,
4- DropdownMenu ,
5- Row ,
6- Surface ,
7- Host ,
8- RNHostView ,
9- Text ,
10- } from "@expo/ui/jetpack-compose" ;
11- import { defaultMinSize , padding , size , weight , width } from "@expo/ui/jetpack-compose/modifiers" ;
3+ clickable ,
4+ defaultMinSize ,
5+ padding ,
6+ size ,
7+ weight ,
8+ width ,
9+ } from "@expo/ui/jetpack-compose/modifiers" ;
1210import { View } from "react-native" ;
1311
1412import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider" ;
@@ -52,7 +50,7 @@ function MenuItem(props: {
5250} ) {
5351 const { action } = props ;
5452 const { appearance, themeVariables : colors } = useAppearancePreferences ( ) ;
55- const { scale, buttonSize , menuWidth } = useAndroidControlSizing ( ) ;
53+ const { scale, menuItemHeight , menuWidth } = useAndroidControlSizing ( ) ;
5654 const body = resolveScaledTextRole ( "body" , appearance . baseFontSize ) ;
5755 const caption = resolveScaledTextRole ( "caption" , appearance . baseFontSize ) ;
5856 const disabled = Boolean ( action . attributes ?. disabled ) ;
@@ -65,43 +63,43 @@ function MenuItem(props: {
6563 : null ;
6664
6765 return (
68- < Surface color = "transparent" enabled = { ! disabled } onClick = { props . onPress } >
69- < Row
70- verticalAlignment = "center"
71- horizontalArrangement = { { spacedBy : 12 * scale } }
72- modifiers = { [
73- width ( menuWidth ) ,
74- defaultMinSize ( { minHeight : buttonSize } ) ,
75- padding ( 16 * scale , 8 * scale , 16 * scale , 8 * scale ) ,
76- ] }
77- >
78- { action . image && isAppSymbolName ( action . image ) ? (
79- < MenuIcon name = { action . image } disabled = { disabled } destructive = { destructive } />
80- ) : null }
81- < Column modifiers = { [ weight ( 1 ) ] } >
82- < Text
83- style = { body }
84- color = {
85- colors [
86- disabled
87- ? "--color-foreground-muted"
88- : destructive
89- ? "--color-danger-foreground"
90- : "--color-foreground"
91- ]
92- }
93- >
94- { action . title }
66+ // Clickable Surface enforces 48dp even when its content requests a smaller row.
67+ < Row
68+ verticalAlignment = "center"
69+ horizontalArrangement = { { spacedBy : 12 * scale } }
70+ modifiers = { [
71+ width ( menuWidth ) ,
72+ defaultMinSize ( { minHeight : menuItemHeight } ) ,
73+ ...( disabled ? [ ] : [ clickable ( props . onPress ) ] ) ,
74+ padding ( 16 * scale , 8 * scale , 16 * scale , 8 * scale ) ,
75+ ] }
76+ >
77+ { action . image && isAppSymbolName ( action . image ) ? (
78+ < MenuIcon name = { action . image } disabled = { disabled } destructive = { destructive } />
79+ ) : null }
80+ < Column modifiers = { [ weight ( 1 ) ] } >
81+ < Text
82+ style = { body }
83+ color = {
84+ colors [
85+ disabled
86+ ? "--color-foreground-muted"
87+ : destructive
88+ ? "--color-danger-foreground"
89+ : "--color-foreground"
90+ ]
91+ }
92+ >
93+ { action . title }
94+ </ Text >
95+ { action . subtitle ? (
96+ < Text style = { caption } color = { colors [ "--color-foreground-muted" ] } >
97+ { action . subtitle }
9598 </ Text >
96- { action . subtitle ? (
97- < Text style = { caption } color = { colors [ "--color-foreground-muted" ] } >
98- { action . subtitle }
99- </ Text >
100- ) : null }
101- </ Column >
102- { trailingIcon ? < MenuIcon name = { trailingIcon } disabled = { disabled } /> : null }
103- </ Row >
104- </ Surface >
99+ ) : null }
100+ </ Column >
101+ { trailingIcon ? < MenuIcon name = { trailingIcon } disabled = { disabled } /> : null }
102+ </ Row >
105103 ) ;
106104}
107105
0 commit comments