Since renderText receives only one argument with formatted text there is no way to pass unhandled props ("otherProps") down.
Imagine code is refactored from:
<NumberFormat
displayType="text"
className="foo"
value="123"
/>
to:
<NumberFormat
displayType="text"
className="foo"
value="123"
renderText={formattedValue => <span>{formattedValue}</span>}
/>
After refactoring class wont be renderred.
Proposal is to pass otherProps variable to renderText as well as value. (Im referring to this line)
Make sense. +1
I can see a usecase for this where renderText prop is provided dynamically based on some props.
But in simple case I will suggest to have those props directly on span.
@s-yadav Can I take this up?
Sure @nikhil-varma.
@s-yadav Noticing the name and keeping in mind backward compatibility, would you suggest keeping the name renderText and pass another argument as otherProps is okay or should we add a new Prop/function indicating that the method also returns the props with it?
We can use the same method and pass others props as second parameter.
@fedulovivan This issue is now fixed and changes are merged! Closing this 馃檪