Skip to content

Commit

Permalink
[Rating] Warn if precision prop is less than 0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexAndriyanenko committed Apr 10, 2020
1 parent e9eb2df commit 9e7275b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/material-ui-lab/src/Rating/Rating.js
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,17 @@ Rating.propTypes = {
/**
* The minimum increment value change allowed.
*/
precision: PropTypes.number,
precision: chainPropTypes(PropTypes.number, (props) => {
if (props.precision < 0.1) {
return new Error(
[
'Material-UI: the prop `precision` should be above 0.1.',
'A value below this limit has an imperceptible impact.',
].join('\n'),
);
}
return null;
}),
/**
* Removes all hover effects and pointer events.
*/
Expand Down

0 comments on commit 9e7275b

Please sign in to comment.