how do I changed the underlayColor on menu trigger? it doesn't seem to work
astroana opened this issue · 2 comments
astroana commented
<Menu>
<MenuTrigger
customStyles={{
TriggerTouchableComponent: TouchableHighlight,
triggerTouchable: {
activeOpacity: 0.5,
underlayColor: 'green',
},
}}
>
<FontAwesome5I
style={navstyle.notificationicon}
name="bell"
solid
/>
</MenuTrigger>
<MenuOptions>
<MenuOption>
<Text>
Sample
</Text>
</MenuOption>
</MenuOptions>
</Menu>
underlay color doesn't change when clicked it stays the same color
astroana commented
got it working
nsdub commented
In case you were like me and wondering why setting the underlayColor doesn't work on Android, the culprit lies here.
export function makeTouchable(TouchableComponent) {
const Touchable = TouchableComponent || Platform.select({
android: TouchableNativeFeedback,
ios: TouchableHighlight,
default: TouchableHighlight,
});
let defaultTouchableProps = {};
if (Touchable === TouchableHighlight) {
defaultTouchableProps = { underlayColor: 'rgba(0, 0, 0, 0.1)' };
}
return { Touchable, defaultTouchableProps };
}
If you switch android to the TouchableHighlight
component as well, then you'll be set.