Fix AmountInput default value (fix #1267)
The default value could be -50
. We then create two properties from it: value
(which equals -50
) and isNegative
(which is true
).
Later, when toggling the sign we set isNegative
to false
and compute a value based on those two properties: if isNegative
is true, we return -value
(--50 -> 50), else value
, so we return value
which still equals -50
.
The value displayed was always correct because we applied Math.abs
to it.
Edited by Nicolas Frandeboeuf