-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
Cannot use wrapper for ListItemSecondaryAction #11622
Comments
Following the documentation, this fix the issue :) // Wrapper of ListItemSecondaryAction
const SecondaryActionWrapper = ({ ...props }) => <ListItemSecondaryAction {...props} />
+SecondaryActionWrapper.muiName = "ListItemSecondaryAction"; |
That works, thank you @oliviertassinari ! |
@oliviertassinari Hello, I'm new to using react and not understanding the solution. I'm running into this same issue after following the documentation.Props are defined on the parent component. Is this the correct approach? I'm still unable to click the secondary action without triggering the link. render(){
const SecondaryActionWrapper = ({ ...props }) => <ListItemSecondaryAction {...props} />
SecondaryActionWrapper.muiName = "ListItemSecondaryAction";
return(
<ListItem dense button component={this.renderLink}>
<ListItemText inset style= {{fontSize: 12}} primary={data.title}/>
{icon && <SecondaryActionWrapper>{icon}</SecondaryActionWrapper>}
</ListItem>
)
} |
@montiquewillis It should be working. If you have a live reproduction example, on Codesandbox for instance, you can open a new issue. |
Similar to #11231
Expected Behavior
When using a wrapper component of the
ListItemSecondaryAction
in the list item:When hovering over the list item body, the whole list item is highlighted:
When hovering over the button(secondary action), only the button is highlighted:
When clicking the button(secondary action), only the button receives the click event.
Current Behavior
When hovering over the button(secondary action), both the list item and the button are highlighted:
When clicking the button(secondary action), both the list item and the button receive the click event.
Steps to Reproduce (for bugs)
SecondaryActionWrapper
with theListItemSecondaryAction
(demo.js), all should work normally as in the official demo: https://codesandbox.io/s/006wj9mnknContext
Your Environment
The text was updated successfully, but these errors were encountered: