Last active
January 4, 2019 09:43
-
-
Save AlexGeb/7d5849d3d38b60a8f874cc59b92af082 to your computer and use it in GitHub Desktop.
NumberFormat for displaying percentage with '%' suffix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function PercentageNumber(props) { | |
const { value, inputRef, onChange, fieldName, ...other } = props; | |
return ( | |
<NumberFormat | |
{...other} | |
value={value * 100} | |
decimalScale={2} | |
getInputRef={inputRef} | |
onValueChange={values => { | |
onChange(values.value / 100); | |
}} | |
suffix="%" | |
/> | |
); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment