-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modify componentWillReceiveProps to check with mask to see if mask va… #38
base: master
Are you sure you want to change the base?
Conversation
…lue would be updated by new props rather than just checking to see if props have changes. Fixes issue where if a change is rejected by the client onChange handler, the component does not re-render
This looks like a solid pull request to me. What's holding this back? |
To follow up on this:
Is the end result that the Mask incorrectly renders More directly, does this implement a bug fix or an optimization? |
@iamdustan Yes, the end result is that the mask incorrectly renders 999%. Possibly this is related to how we are using the component. We are effectively using it as a controlled component. Interestingly, I just upgraded our app to React 15, and I'm now getting warnings that MaskedInput needs to decide whether it is a controlled component or an uncontrolled component... Not sure if that is because our fork is behind and this has been remedied in the master origin, or whether this is a general problem with the implementation. e.g.
|
Actually, scratch my last comment about the warnings - I think that is a result of how we've integrated it. We're using it with React Redux Form, and I think that is where the duplicate defaultValue/value props are coming from. |
Would love to see this merged sometime |
…lue would be updated by new props rather than just checking to see if props have changes. Fixes issue where if a change is rejected by the client onChange handler, the component does not re-render.
See: insin/inputmask-core#16
mask: '111%'
Type: 9
MaskValue: 9%
Type: 9
MaskValue: 99%
Type: 9
MaskValue: 999%
But the value of 999 is rejected by onChange handler so component re-renders with props of 99 again. But the mask does not re-render as componentWillReceiveNewProps checks to see if props have changed and in this case have not.