From 6beec1c178dc277402321e0b120885f7f79b4dcd Mon Sep 17 00:00:00 2001 From: Ben-hur Santos Ott Date: Sun, 6 Jan 2019 21:38:35 -0200 Subject: [PATCH] fix(#115): fixing setNativeProps error --- CHANGELOG.md | 5 +++++ lib/text-input-mask.js | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0100f242..aa64d285 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ - Credit Card Mask: adding support for `diners` and `amex`. (Thanks to [Marin Bezhanov](https://github.com/mbezhanov)) +### Fix + +- [#107](https://github.com/benhurott/react-native-masked-text/issues/107): Props missing - TypeScript map out of date. +- [#115](https://github.com/benhurott/react-native-masked-text/issues/115): setNativeProps is not a function + ## [1.9.2] - 2018-10-06 ### Fixed diff --git a/lib/text-input-mask.js b/lib/text-input-mask.js index f3a2363b..916c1f22 100644 --- a/lib/text-input-mask.js +++ b/lib/text-input-mask.js @@ -17,12 +17,20 @@ export default class TextInputMask extends BaseTextComponent { self.updateValue(text).then(maskedText => { if (self.props.onChangeText) { - this.getElement().setNativeProps({ text: maskedText }) + this._trySetNativeProps(maskedText) self.props.onChangeText(maskedText) } }) } + _trySetNativeProps(maskedText) { + try { + this.getElement().setNativeProps({ text: maskedText }) + } catch (error) { + // silent + } + } + _checkText(text) { if (this.props.checkText) { return this.props.checkText(this.state.value, text)