Skip to content

Warning: React does not recognize the iconHovered prop on a DOM element #32

@goldylucks

Description

@goldylucks

See image below.

# cat client/node_modules/material-ui-rating/package.json | grep version      
"version": "4.1.0",
Here's my Rating component, there's no `iconHovered` in there
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import MuiRating from 'material-ui-rating'
import { withStyles } from '@material-ui/core'

class Rating extends Component {
  static propTypes = {
    classes: PropTypes.object.isRequired,
    value: PropTypes.number.isRequired,
    muiRatingClasses: PropTypes.object,
    readOnly: PropTypes.bool,
  }

  static defaultProps = {
    muiRatingClasses: {},
    readOnly: true,
  }

  render() {
    const {
      classes,
      value,
      muiRatingClasses,
      readOnly,
      ...restOfProps
    } = this.props
    return (
      <MuiRating
        classes={{
          root: classes.starsRoot,
          icon: classes.star,
          iconButton: classes.starButton,
          ...muiRatingClasses,
        }}
        value={value}
        readOnly
        {...restOfProps}
      />
    )
  }
}

const HEIGHT = 20

const styles = () => ({
  starsRoot: {
    display: 'flex',
    alignItems: 'center',
    height: HEIGHT,
  },
  starButton: {
    padding: 0,
    margin: 0,
    transform: 'scaleX(-1)',
    '& > span': {
      height: HEIGHT,
    },
  },
  star: {
    height: HEIGHT,
    width: 16,
  },
})

export default withStyles(styles)(Rating)

can you look into it? thanks!

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions