You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the value is changed, in componentWillReceiveProps the display value is calculated
like so
but the formatInput method uses the this.props instead of the newProps which is sent to the componentWillReceiveProps.
I was updating the value and suffix props, but the new suffix was not used, instead the older suffix gets used as it is referring to this.props instead of newProps.
The solution is to pass the props along to the formatInput and the other methods it invokes so this.props is never used from inside them. However once you remove the reference to this.props, these methods no longer need to be bound to the class, they could simply be functions outside of the class.
I am happy to do a PR, but need your direction on what you prefer, send props as an additional argument to formatInput, getSeparators, getNumberRegex, formatWithPattern
or
remove these functions out of the class and have them as pure functions which take in just the necessary input arguments
The suggested solution above fixes not only the suffix but also prefix and the whole list of props getting updated
The text was updated successfully, but these errors were encountered:
When the value is changed, in
componentWillReceiveProps
the display value is calculatedlike so
but the
formatInput
method uses thethis.props
instead of thenewProps
which is sent to thecomponentWillReceiveProps
.I was updating the
value
andsuffix
props, but the newsuffix
was not used, instead the older suffix gets used as it is referring tothis.props
instead ofnewProps
.The solution is to pass the props along to the
formatInput
and the other methods it invokes sothis.props
is never used from inside them. However once you remove the reference to this.props, these methods no longer need to be bound to the class, they could simply be functions outside of the class.I am happy to do a PR, but need your direction on what you prefer, send props as an additional argument to
formatInput
,getSeparators
,getNumberRegex
,formatWithPattern
or
remove these functions out of the class and have them as pure functions which take in just the necessary input arguments
The suggested solution above fixes not only the suffix but also prefix and the whole list of props getting updated
The text was updated successfully, but these errors were encountered: