Skip to content

Commit

Permalink
fix(#115): fixing setNativeProps error
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-hur Santos Ott committed Jan 6, 2019
1 parent 5a8a233 commit 6beec1c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion lib/text-input-mask.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6beec1c

Please sign in to comment.