Unverified Commit f95839c7 authored by Joel's avatar Joel Committed by GitHub

fix: input not set min or max null value blur would set null (#2361)

parent 5a004ae4
...@@ -26,12 +26,14 @@ const Input: FC<InputProps> = ({ ...@@ -26,12 +26,14 @@ const Input: FC<InputProps> = ({
max, max,
}) => { }) => {
const toLimit = (v: string) => { const toLimit = (v: string) => {
if (min !== undefined && parseFloat(v) < min) { const minNum = parseFloat(`${min}`)
const maxNum = parseFloat(`${max}`)
if (!isNaN(minNum) && parseFloat(v) < minNum) {
onChange(`${min}`) onChange(`${min}`)
return return
} }
if (max !== undefined && parseFloat(v) > max) if (!isNaN(maxNum) && parseFloat(v) > maxNum)
onChange(`${max}`) onChange(`${max}`)
} }
return ( return (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment