diff --git a/README.md b/README.md index da98ed3a..9d7f543b 100644 --- a/README.md +++ b/README.md @@ -404,6 +404,9 @@ var money = MaskService.toMask('money', '123', { # Changelog +## 1.6.1 +* Fixing duplicated custom text input component. (thanks to [Pablo](https://github.com/rochapablo)) + ## 1.6.0 * Add compatibility to [react-native-textinput-effects](https://github.com/halilb/react-native-textinput-effects) by using `customTextInputProps` (thanks to [Pablo](https://github.com/rochapablo)) diff --git a/lib/text-input-mask.js b/lib/text-input-mask.js index 91a53f9b..528ccf8a 100644 --- a/lib/text-input-mask.js +++ b/lib/text-input-mask.js @@ -7,16 +7,7 @@ import BaseTextComponent from './base-text-component'; const INPUT_TEXT_REF = '$input-text'; -let Input = TextInput -let customTextInputProps = {} - export default class TextInputMask extends BaseTextComponent { - constructor(props) { - super(props); - if (props.customTextInput) Input = props.customTextInput - if (props.customTextInputProps) customTextInputProps = props.customTextInputProps - } - getElement() { return this.refs[INPUT_TEXT_REF]; } @@ -49,6 +40,14 @@ export default class TextInputMask extends BaseTextComponent { } render() { + let Input = TextInput + let customTextInputProps = {} + + if (this.props.customTextInput) { + Input = this.props.customTextInput + customTextInputProps = this.props.customTextInputProps || {} + } + return (