-
Notifications
You must be signed in to change notification settings - Fork 194
Update pattern #9
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
Conversation
dist/react-maskedinput.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should use this.mask.getRawValue() - this way it's not going to put placeholders where chars should be when the pattern changes.
|
This looks to address most of the issues I noted here: #8 (comment) Perhaps if this could get rebased against master (squashing the commits) this could be a contender for being really close for a fix to #8 \o/ See #8 (comment) for the one remaining nit. Going from a short pattern to a longer pattern via paste, the selection is not at the the end of the string. We can probably look at fixing that separately in any case. |
update mask method dist fix the update input selection dist prev props dist getRawValue
|
@muffinresearch You got it. |
|
Hmm not sure what's happening but the dist file looks to be out of date e.g. it's missing the |
|
Hey, just grabbed this one to see if it fixed my issue - PR has issues with pattern vs match so the following code snippet is the fixed version of the code (No time to make PR sorry). AFAIK this works for all issues in #8 as well (didn't extensively test though). componentWillUpdate(nextProps, nextState) {
if (nextProps.mask !== this.props.mask) {
this._updatePattern(nextProps)
}
},
componentDidUpdate(prevProps) {
if (prevProps.mask !== this.props.mask && this.mask.selection.start) {
this._updateInputSelection()
}
},
_updatePattern: function(props) {
this.mask.setPattern(props.mask, {
value: this.mask.getRawValue(),
selection: getSelection(this.input)
});
}, |
|
Closed by #53 |
No description provided.