Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: handler for <List selection/> #1301

Closed
rokoroku opened this issue Feb 9, 2017 · 3 comments
Closed

Feature request: handler for <List selection/> #1301

rokoroku opened this issue Feb 9, 2017 · 3 comments

Comments

@rokoroku
Copy link
Contributor

rokoroku commented Feb 9, 2017

List could be selectable (or clickable) with selection prop, but there is no way to catch the event.

I'll be very happy when we have a new prop like onItemClick from menu.

    /**
     * onClick handler for ListItem. Mutually exclusive with children.
     *
     * @param {SyntheticEvent} event - React's original SyntheticEvent.
     * @param {object} data - All item props.
     */
    onItemClick: customPropTypes.every([
      customPropTypes.disallow(['children']),
      PropTypes.func,
    ]),
@levithomason
Copy link
Member

levithomason commented Feb 11, 2017

I would take a PR for this.

A workaround is to pass the handler to each item either as a component prop or shorthand object prop. You can also let the event bubble and capture it.

http://codepen.io/levithomason/pen/WRYaxY

This does not give you the item's props, which is why I'd take a PR for this feature.

@rokoroku
Copy link
Contributor Author

For someone who wants props, here is another workaround currently I use.
We can receive props in this way :)

http://codepen.io/anon/pen/WRYYdw

@layershifter
Copy link
Member

Was done in #1530

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants