Skip to content

"rr--on" is not added during hover if itemStyles is used. #26

@alekseykurylev

Description

@alekseykurylev

"rr--on" is not added during hover if itemStyles is used. If you do not specify itemStyles, then everything works correctly.

v1.5.0

import { useState } from 'react';

import { Rating, ThinStar } from '@smastrom/react-rating';

function App() {
  const [rating, setRating] = useState(0);
  const [hover, setHover] = useState(0);

  function onChange(newValue: number) {
    console.log(newValue);
    setRating(newValue);
  }

  const myStyles = {
    itemShapes: ThinStar,
    activeFillColor: '#ffb700',
    inactiveFillColor: '#fbf1a9',
  };

  return (
    <div className="App">
      <Rating
        style={{ maxWidth: 180 }}
        value={rating}
        onChange={onChange}
        onHoverChange={setHover}
        itemStyles={myStyles}
      />
      {hover}
    </div>
  );
}

export default App;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions