Skip to content

Conversation

@Philmod
Copy link

@Philmod Philmod commented Jul 9, 2015

No description provided.

Copy link
Collaborator

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.

@muffinresearch
Copy link
Collaborator

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
@Philmod
Copy link
Author

Philmod commented Jul 28, 2015

@muffinresearch You got it.

@muffinresearch
Copy link
Collaborator

@insin would you have some time to take a look at this patch in relation to #8 ?

@muffinresearch
Copy link
Collaborator

Hmm not sure what's happening but the dist file looks to be out of date e.g. it's missing the componentWillReceiveProps that's in the .jsx flle. Also testing the changes I'm no longer seeing pattern updates rendering. Can you see if still works for you?

@SimeonC
Copy link

SimeonC commented Feb 18, 2016

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)
    });
  },

@iamdustan
Copy link
Collaborator

Closed by #53

@iamdustan iamdustan closed this May 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants