diff --git a/README.md b/README.md index 2a98ec58..9c30fffd 100644 --- a/README.md +++ b/README.md @@ -285,6 +285,10 @@ var money = MaskService.toMask('money', '123', { # Changelog +## 1.3.4 +* Remove default value from mask to allow placeholder on text-input (thanks to [Cuong Hoang](https://github.com/cuonghv91)). + * Please, caution. This can cause some runtime breaking if you update to this version. + ## 1.3.3 * Update dependencies (thanks to [Vlad-Zhukov](https://github.com/Vlad-Zhukov)) diff --git a/lib/base-text-component.js b/lib/base-text-component.js index a9242497..dee18f09 100644 --- a/lib/base-text-component.js +++ b/lib/base-text-component.js @@ -74,12 +74,22 @@ export default class BaseTextComponent extends Component { self._resolveMaskHandler(); } + let value = self._getDefaultMaskedValue(props.value); + self.setState({ - value: self._getMaskedValue(props.value) + value: value }); }); } + _getDefaultMaskedValue(value) { + if (this._getDefaultValue(value) === '') { + return '' + } + + return this._getMaskedValue(value) + } + _getMaskedValue(value) { return this._maskHandler.getValue( this._getDefaultValue(value), diff --git a/package.json b/package.json index 6626defc..2db7a85e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-masked-text", - "version": "1.3.3", + "version": "1.3.4", "description": "Text and TextInput with mask for React Native applications", "main": "index.js", "scripts": {