Skip to content

Commit

Permalink
Add note for minValue and maxValue
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yadav committed Aug 13, 2023
1 parent 1100ad7 commit 5565aa8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions documentation/v5/docs/quirks.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ values object is on following format
}
```

Its recommended to use formattedValue / value / floatValue based on the initial state (it should be same as the initial state format) which you are passing as value prop. If you are saving the `value` key on state make sure to pass valueIsNumericString prop to true.
Its recommended to use formattedValue / value / floatValue based on the initial state (it should be same as the initial state format) which you are passing as value prop. If you are saving the `value` key on state and any of the format prop like prefix/suffix contains number make sure to pass valueIsNumericString prop to true.

### Notes and quirks

1. Value can be passed as string or number, but if it is passed as string it should be either formatted value or if it is a numeric string, you have to set valueIsNumericString props to true.
1. Value can be passed as string or number, but if it is passed as string it should be either formatted value or if it is a numeric string and any of the format prop like prefix/suffix contains number, you have to set valueIsNumericString props to true.

2. Value as prop will be rounded to given decimal scale if format option is not provided.

Expand All @@ -35,6 +35,10 @@ Its recommended to use formattedValue / value / floatValue based on the initial

7. onValueChange is not same as onChange. It gets called on whenever there is change in value which can be caused by any event like change or blur event or by a prop change. It also provides a second argument which contains the event object and the reason for this function trigger.

8. `minLength` and `maxLength` prop of native input doesn't work as expected, as the formatting happens post the number is added on the input. You can achieve similar result using isAllowed prop.

Related issue: https://github.com/s-yadav/react-number-format/issues/758

## SourceInfo object

The `sourceInfo` object indicates whether the triggered change is due to an event or a prop change. This is particularly useful in identify whether the change is user driven or is an uncontrolled change due to any prop value being updated.
Expand Down

0 comments on commit 5565aa8

Please sign in to comment.