Created
December 20, 2017 16:51
-
-
Save krescruz/4b3efc559db2993d2db0a2aa8c282159 to your computer and use it in GitHub Desktop.
React masked input
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react' | |
import MaskedInputBase from 'react-maskedinput' | |
class MaskedInput extends Component { | |
getValue() { | |
const value = this.refs.masked.mask.getRawValue() | |
return value.replace(/[\s,_]/g, '') | |
} | |
render() { | |
return <MaskedInputBase { ...this.props } ref='masked' /> | |
} | |
} | |
export default MaskedInput |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Get the final value of a mask input
Example:
this.refs.myinput.getValue()