From 141e2cdf8a8c6a886a3f9ee4f25c77f1c59468cf Mon Sep 17 00:00:00 2001 From: luancurti Date: Sat, 3 Aug 2019 19:49:05 -0300 Subject: [PATCH 1/7] docs: update example only number link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b5714a64..2e57a2da 100644 --- a/README.md +++ b/README.md @@ -535,7 +535,7 @@ console.log(numberValue) // Number Mask: `accept only numbers` -Sample code ([source](https://github.com/benhurott/react-native-masked-text-samples/blob/master/ReactNativeMaskedTextSamples/Samples/ZipCode.js)): +Sample code ([source](https://github.com/benhurott/react-native-masked-text-samples/blob/master/ReactNativeMaskedTextSamples/Samples/OnlyNumbers.js)): ```jsx From a2bf8fa4e852342ce7e1d63678ed2bca36874743 Mon Sep 17 00:00:00 2001 From: RodrigoAWeber Date: Wed, 7 Aug 2019 14:29:33 -0300 Subject: [PATCH 2/7] componentDidUpdate should pass prevProps to _bindProps function --- lib/base-text-component.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/base-text-component.js b/lib/base-text-component.js index e4da6950..35807a09 100644 --- a/lib/base-text-component.js +++ b/lib/base-text-component.js @@ -11,8 +11,8 @@ export default class BaseTextComponent extends PureComponent { this._bindProps(this.props); } - componentDidUpdate() { - this._bindProps(this.props); + componentDidUpdate(prevProps) { + this._bindProps(prevProps); } updateValue(text) { From 6b544b19883c641181d6944c92f25bbdbb8c1325 Mon Sep 17 00:00:00 2001 From: Marcin Date: Fri, 9 Aug 2019 15:15:11 +0100 Subject: [PATCH 3/7] migrate from moment.js to date-and-time --- __tests__/mask/datetime.mask.test.js | 8 ++++---- dist/lib/masks/datetime.mask.js | 2 +- lib/masks/datetime.mask.js | 6 +++--- package.json | 2 +- yarn.lock | 5 +++++ 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/__tests__/mask/datetime.mask.test.js b/__tests__/mask/datetime.mask.test.js index c064ec0c..22ba166b 100644 --- a/__tests__/mask/datetime.mask.test.js +++ b/__tests__/mask/datetime.mask.test.js @@ -1,9 +1,9 @@ import { DatetimeMask } from '../../lib/masks' -var moment = require('moment') +import date from 'date-and-time'; function compareMomentObj(dateTimeA, dateTimeB) { - var momentA = moment(dateTimeA, 'DD/MM/YYYY') - var momentB = moment(dateTimeB, 'DD/MM/YYYY') + var momentA = new Date(dateTimeA) + var momentB = new Date(dateTimeB) if (momentA > momentB) return 1 else if (momentA < momentB) return -1 else return 0 @@ -94,7 +94,7 @@ test('01011990174030 with format DD/MM/YYYY HH:mm:ss results 01/01/1990 17:40:30 var expected = '01/01/1990 17:40:30' var received = mask.getValue('01011990174030') - var expectedRawValue = moment(received, 'DD/MM/YYYY HH:mm:ss', true) + var expectedRawValue = date.parse(received, 'DD/MM/YYYY HH:mm:ss') var receivedRawValue = mask.getRawValue(received) expect(received).toBe(expected) diff --git a/dist/lib/masks/datetime.mask.js b/dist/lib/masks/datetime.mask.js index a3e9eedc..eed58f93 100644 --- a/dist/lib/masks/datetime.mask.js +++ b/dist/lib/masks/datetime.mask.js @@ -1 +1 @@ -Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i Date: Tue, 13 Aug 2019 17:00:40 -0300 Subject: [PATCH 4/7] updating version and changelog --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c74dbfdb..ed27152c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## Unreleased +## [1.13.0] - 2019-08-13 + +### Docs + +- Fixing documentaion link. + - Thanks to [Luan Curti](https://github.com/luancurti) for contributing! + ## [1.12.5] - 2019-08-03 ### Fix diff --git a/package.json b/package.json index 574624ab..f698db58 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-masked-text", - "version": "1.12.5", + "version": "1.13.0", "description": "Text and TextInput with mask for React Native applications", "licenses": [ { From abe18c68e12c2d3215ed5ab8559d3b8ce36263ef Mon Sep 17 00:00:00 2001 From: Ben-hur Santos Ott Date: Tue, 13 Aug 2019 17:10:34 -0300 Subject: [PATCH 5/7] update changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed27152c..d01f952e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ ## [1.13.0] - 2019-08-13 +### Fix + +- [#184](https://github.com/benhurott/react-native-masked-text/issues/184) TextInputMask doesnt render mask correctly when type change. + - Thanks to [Rodrigo Weber](https://github.com/RodrigoAWeber) for contributing! + ### Docs - Fixing documentaion link. From 8c41ded7280efe928b5e3f19c4f306ce4a6f5ed0 Mon Sep 17 00:00:00 2001 From: Ben-hur Santos Ott Date: Tue, 13 Aug 2019 17:42:47 -0300 Subject: [PATCH 6/7] updating deps --- lib/masks/datetime.mask.js | 8 ++++---- package.json | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/masks/datetime.mask.js b/lib/masks/datetime.mask.js index b3146950..d87ebcb3 100644 --- a/lib/masks/datetime.mask.js +++ b/lib/masks/datetime.mask.js @@ -1,6 +1,6 @@ import BaseMask from './_base.mask' import CustomMask from './custom.mask' -import date from 'date-and-time'; +import date from 'date-and-time' const DATETIME_MASK_SETTINGS = { format: 'DD/MM/YYYY HH:mm:ss' @@ -24,9 +24,9 @@ export default class DatetimeMask extends BaseMask { } validate(value, settings) { - var maskedValue = this.getValue(value, settings) + let maskedValue = this.getValue(value, settings) let mergedSettings = this._getMergedSettings(settings) - var isValid = date.isValid(maskedValue, mergedSettings.format) + let isValid = date.isValid(maskedValue, mergedSettings.format) return isValid } @@ -37,7 +37,7 @@ export default class DatetimeMask extends BaseMask { getMask(value, settings) { let mask = '' - for (var i = 0; i < settings.format.length; i++) { + for (let i = 0; i < settings.format.length; i++) { mask += settings.format[i].replace(/[a-zA-Z]+/g, '9') } diff --git a/package.json b/package.json index 4077f7a5..414b0540 100644 --- a/package.json +++ b/package.json @@ -36,14 +36,14 @@ }, "homepage": "https://github.com/benhurott/react-native-masked-text#readme", "dependencies": { - "date-and-time": "^0.9.0", - "tinymask": "^1.0.2" + "date-and-time": "0.9.0", + "tinymask": "1.0.2" }, "devDependencies": { "@types/react-native": "*", "@types/react": "*", - "babel-cli": "^6.26.0", - "rimraf": "^2.6.2", + "babel-cli": "6.26.0", + "rimraf": "2.6.2", "react": "16.3.1", "react-native": "0.55.4", "babel-jest": "23.4.2", From ac07113c988fbf4fe4c992bc34388105438446ea Mon Sep 17 00:00:00 2001 From: Ben-hur Santos Ott Date: Tue, 13 Aug 2019 17:44:36 -0300 Subject: [PATCH 7/7] updating docs --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d01f952e..8bd38365 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ ## [1.13.0] - 2019-08-13 +### Chore + +- [BREAKING CHANGE] Migrating from `moment` to `date-and-time`. + - Thanks to [Marcin Krysiak](https://github.com/marcinkrysiak1979) for contributing! + ### Fix - [#184](https://github.com/benhurott/react-native-masked-text/issues/184) TextInputMask doesnt render mask correctly when type change.