@@ -8,23 +8,31 @@ import {
88 Text ,
99} from "@expo/ui/jetpack-compose" ;
1010import { defaultMinSize , padding , size , width } from "@expo/ui/jetpack-compose/modifiers" ;
11- import { View } from "react-native" ;
11+ import { Pressable } from "react-native" ;
1212import { resolveScaledTextRole } from "../../lib/appearancePreferences" ;
1313
1414import { useAndroidControlSizing } from "./useAndroidControlSizing" ;
1515import { useAppearancePreferences } from "../../features/settings/appearance/AppearancePreferencesProvider" ;
1616import type { MenuPopupProps } from "./MenuPopup" ;
1717import { isAppSymbolName , SymbolView , type AppSymbolName } from "./AppSymbol" ;
1818
19+ // The glyph is a React Native view hosted in the Compose row, and its native host consumes
20+ // every touch over it, so the row's onClick never sees a tap on the icon. The glyph runs the
21+ // row's action itself; the row stays the accessible element.
1922function MenuIcon ( props : {
2023 readonly name : AppSymbolName ;
24+ readonly onPress : ( ) => void ;
2125 readonly destructive ?: boolean ;
2226 readonly disabled ?: boolean ;
2327} ) {
2428 const { iconSize } = useAndroidControlSizing ( ) ;
2529 return (
2630 < RNHostView matchContents modifiers = { [ size ( iconSize , iconSize ) ] } >
27- < View
31+ < Pressable
32+ accessible = { false }
33+ focusable = { false }
34+ disabled = { props . disabled }
35+ onPress = { props . onPress }
2836 style = { { width : iconSize , height : iconSize } }
2937 importantForAccessibility = "no-hide-descendants"
3038 >
@@ -40,7 +48,7 @@ function MenuIcon(props: {
4048 : "accent-foreground"
4149 }
4250 />
43- </ View >
51+ </ Pressable >
4452 </ RNHostView >
4553 ) ;
4654}
@@ -60,7 +68,7 @@ export function MenuPopup(props: MenuPopupProps) {
6068 { props . parent ? (
6169 < DropdownMenuItem onClick = { props . onBack } modifiers = { itemModifiers } >
6270 < DropdownMenuItem . LeadingIcon >
63- < MenuIcon name = "arrow.left" />
71+ < MenuIcon name = "arrow.left" onPress = { props . onBack } />
6472 </ DropdownMenuItem . LeadingIcon >
6573 < DropdownMenuItem . Text >
6674 < Text color = { foreground } style = { { typography : "bodyLarge" , ...body } } >
@@ -88,6 +96,7 @@ export function MenuPopup(props: MenuPopupProps) {
8896 < DropdownMenuItem . LeadingIcon >
8997 < MenuIcon
9098 name = { action . image }
99+ onPress = { ( ) => props . onPress ( action ) }
91100 destructive = { action . attributes ?. destructive }
92101 disabled = { action . attributes ?. disabled }
93102 />
@@ -116,11 +125,19 @@ export function MenuPopup(props: MenuPopupProps) {
116125 </ DropdownMenuItem . Text >
117126 { ( action . subactions ?. length ?? 0 ) > 0 ? (
118127 < DropdownMenuItem . TrailingIcon >
119- < MenuIcon name = "chevron.right" disabled = { action . attributes ?. disabled } />
128+ < MenuIcon
129+ name = "chevron.right"
130+ onPress = { ( ) => props . onPress ( action ) }
131+ disabled = { action . attributes ?. disabled }
132+ />
120133 </ DropdownMenuItem . TrailingIcon >
121134 ) : action . state === "on" ? (
122135 < DropdownMenuItem . TrailingIcon >
123- < MenuIcon name = "checkmark" disabled = { action . attributes ?. disabled } />
136+ < MenuIcon
137+ name = "checkmark"
138+ onPress = { ( ) => props . onPress ( action ) }
139+ disabled = { action . attributes ?. disabled }
140+ />
124141 </ DropdownMenuItem . TrailingIcon >
125142 ) : null }
126143 </ DropdownMenuItem >
0 commit comments