feat: numeric validation

This commit is contained in:
cha0s 2020-06-22 00:59:01 -05:00
parent 43cb09e048
commit 8a3b1654e4

View File

@ -30,7 +30,13 @@ const Number = ({
: ( : (
<> <>
<input <input
onChange={(event) => onChange(event.target.value, event)} onChange={(event) => {
const {value: number} = event.target;
// eslint-disable-next-line no-restricted-globals
if (!isNaN(number)) {
onChange('' === number ? 0 : number, event);
}
}}
// onWheel={(e) => (e.preventDefault(), false)} // onWheel={(e) => (e.preventDefault(), false)}
type="text" type="text"
value={value} value={value}