Skip to content

Commit

Permalink
fix(customTextInput): fixing duplicated element
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-hur Santos Ott committed Aug 15, 2017
1 parent a2fe766 commit 2793cae
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
17 changes: 8 additions & 9 deletions lib/text-input-mask.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down Expand Up @@ -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 (
<Input
ref={INPUT_TEXT_REF}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-masked-text",
"version": "1.6.0",
"version": "1.6.1",
"description": "Text and TextInput with mask for React Native applications",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 2793cae

Please sign in to comment.