From 962f8eace880cb2e2e3b6018b34ff930f42b484f Mon Sep 17 00:00:00 2001 From: Ben-hur Santos Ott Date: Fri, 17 May 2019 13:39:07 -0300 Subject: [PATCH] fixing initial value when component is mounted --- CHANGELOG.md | 6 ++++++ dist/lib/base-text-component.js | 2 +- dist/lib/text-input-mask.js | 2 +- dist/lib/text-mask.js | 2 +- lib/base-text-component.js | 4 ++++ lib/text-input-mask.js | 6 +++++- lib/text-mask.js | 6 +++++- package.json | 2 +- 8 files changed, 24 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 469bbaeb..6a079662 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## Unreleased +## [1.12.3] - 2019-05-17 + +### Fix + +- Fixing [#162](https://github.com/benhurott/react-native-masked-text/issues/162) initial value when mask is updated. (thanks to [Alessandro Sales](https://github.com/alessandrosales) for reporting) + ## [1.12.2] - 2019-04-22 ### Refactor diff --git a/dist/lib/base-text-component.js b/dist/lib/base-text-component.js index df300f06..b5094711 100644 --- a/dist/lib/base-text-component.js +++ b/dist/lib/base-text-component.js @@ -1 +1 @@ -Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i this._onChangeText(text)} - value={this.props.value} + value={ + this.getDisplayValueFor( + this.props.value + ) + } /> ) } diff --git a/lib/text-mask.js b/lib/text-mask.js index e794484e..08041f8b 100644 --- a/lib/text-mask.js +++ b/lib/text-mask.js @@ -17,7 +17,11 @@ export default class TextMask extends BaseTextComponent { render() { return ( - {this.props.value} + { + this.getDisplayValueFor( + this.props.value + ) + } ); } } diff --git a/package.json b/package.json index 3060d7f4..1060d91f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-masked-text", - "version": "1.12.2", + "version": "1.12.3", "description": "Text and TextInput with mask for React Native applications", "licenses": [ {