Hi,
I have toggle which can disable input and set value to undefined.
<NumberFormat
onValueChange={(values) => setState(values.floatValue)}
disabled={!isEnabled}
customInput={Input}
decimalScale={0}
allowNegative={false}
value={value} // can be number or undefined
/>
On disabling input becomes empty and placeholder appears
On disabling input has previous entered value
@Krakof Thanks for reporting this. I was able to create a demo with the expected behavior. When disabling the input, the field is disabled with the entered value. I see that you are using a customInput for your use-case. Can you please provide a CodeSandbox demo link, if that's possible. This will help us investigate it a little better.
Here's the link to the demo I created for this use-case: https://codesandbox.io/s/input-disabled-demo-ke9f6

@nikhil-varma Thanks for your reply
Actually the whole flow is:
On enabling I need to set min value to 1 and on disabling set value to undefined. Please check this demo https://codesandbox.io/s/broken-mountain-yi48g?file=/src/App.js
@Krakof Thanks! This doesn鈥檛 look like a library issue
undefined to the input as value, it does not update it to undefined and neither does not empty it out. It will assign the previous value as is, and you will see no change to the input field. I have demonstrated this in the sandbox link as well.value attribute is as follows:[TreatNullAs=EmptyString] attribute DOMString value;This would mean, for the DOM input
null to any field of any type, it will become emptyundefined,undefined value to a string and then assign the "undefined" string to the input element

But in React, the updates for undefined and null don鈥檛 quite behave in the same way. It is not recommended to set input value to undefined/null since it will not empty the input field rather stick to the last updated value. To clear out the field value, you can use empty string.
Hope this helps resolve the issue and also understand how input field works in a brief way
As @nikhil-varma mentioned you will have to set the value as empty string on undefined / null. If you want to keep it controlled.
<NumberFormat
onValueChange={(values) => setState(values.floatValue)}
disabled={!isEnabled}
customInput={Input}
decimalScale={0}
allowNegative={false}
value={value === undefined ? '' : value} // can be number or undefined
/>
@nikhil-varma Thanks a lot for your explanation
@Krakof You're welcome!
Most helpful comment
As @nikhil-varma mentioned you will have to set the value as empty string on undefined / null. If you want to keep it controlled.