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

[IconMenu] Unable to use IconButton with iconClassName in IconMenu #3653

Closed
leesiongchan opened this issue Mar 10, 2016 · 1 comment
Closed
Labels
component: icon button This is the name of the generic UI component, not the React module! component: Icon The React component. component: menu This is the name of the generic UI component, not the React module! v0.x

Comments

@leesiongchan
Copy link

Problem Description

<IconMenu
  iconButtonElement={
    <IconButton iconClassName="material-icons">
      expand_more
    </IconButton>
  }
>
  <MenuItem primaryText="Download" />
  <MenuItem primaryText="More Info" />
</IconMenu>

Code above will trigger error below:

main.js:4116 Unhandled promise rejection TypeError: Cannot read property 'iconHoverColor' of undefined
    at render (http://localhost:8080/vendor.js:29350:38)
    at ReactCompositeComponentMixin._renderValidatedComponentWithoutOwnerOrContext (http://localhost:8080/vendor.js:16163:35)
    at ReactCompositeComponentMixin._renderValidatedComponent (http://localhost:8080/vendor.js:16183:33)
    at wrapper [as _renderValidatedComponent] (http://localhost:8080/vendor.js:11199:22)
    at ReactCompositeComponentMixin.mountComponent (http://localhost:8080/vendor.js:15796:31)
    at wrapper [as mountComponent] (http://localhost:8080/vendor.js:11199:22)
    at Object.ReactReconciler.mountComponent (http://localhost:8080/vendor.js:14238:36)
    at ReactDOMComponent.ReactMultiChild.Mixin.mountChildren (http://localhost:8080/vendor.js:22230:45)
    at ReactDOMComponent.Mixin._createContentMarkup (http://localhost:8080/vendor.js:19413:33)
    at ReactDOMComponent.Mixin.mountComponent (http://localhost:8080/vendor.js:19301:30)
if (iconClassName) {
  var iconHoverColor = iconStyle.iconHoverColor;

  var iconStyleFontIcon = _objectWithoutProperties(iconStyle, ['iconHoverColor']);

  fonticon = _react2.default.createElement(
    _fontIcon2.default,
    {
      className: iconClassName,
      hoverColor: disabled ? null : iconHoverColor,
      style: (0, _simpleAssign2.default)(styles.icon, disabled && styles.disabled, iconStyleFontIcon)
    },
    this.props.children
  );
}

Versions

  • Material-UI: v0.15.0-alpha.1
  • React: v0.14.7
  • Browser: Chrome 49.0.2623.87 (64-bit)
@tintin1343
Copy link
Contributor

@leesiongchan : What is iconStyle? where did that come from? You haven't specified an iconStyle in your jsx Code.

This is not an MUI issue. I am closing this for now. If you need further help on this, please use the gitter channel of material-ui or post this on stackoverflow using the material-ui tag.

@oliviertassinari oliviertassinari added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 21, 2022
@zannager zannager added component: Icon The React component. component: icon button This is the name of the generic UI component, not the React module! component: menu This is the name of the generic UI component, not the React module! v0.x and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: icon button This is the name of the generic UI component, not the React module! component: Icon The React component. component: menu This is the name of the generic UI component, not the React module! v0.x
Projects
None yet
Development

No branches or pull requests

4 participants