Notice: The Monaca & Onsen UI Community Forum is shutting down.
For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.
Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.
Possible to keep ListItem highlighted after tap?
-
I’m trying to use the List/ListItem classes for a master detail type of UI. Is it possible to keep a ListItem highlighted after it’s tapped…in other words when it’s the active selection in a list of items?
Thanks,
Scott
-
Well…it turned out to be really easy.
const modifiers = ( this.props.selection.job === item ) ? "longdivider selected" : "longdivider"; return ( <ListItem key={index} modifier={modifiers} tappable={true} .....
That’s about it. I added some new CSS that defines the selected modifier to set the background appropriately. And then just set the modifiers for the ListItem when it’s selected. It all just works and it was very straightforward.