From d747e1896a7fc6ed25a2efc7077f35c25b3f729e Mon Sep 17 00:00:00 2001 From: Hellon Canella Date: Sat, 13 May 2017 12:51:17 -0300 Subject: [PATCH] TextInpuMask is able to receive any specilization of TextInput --- lib/text-input-mask.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/text-input-mask.js b/lib/text-input-mask.js index d092fb65..2ee7e9d4 100644 --- a/lib/text-input-mask.js +++ b/lib/text-input-mask.js @@ -1,15 +1,18 @@ import React, { Component } from 'react'; import { - StyleSheet, - TextInput + StyleSheet, + TextInput } from 'react-native'; import BaseTextComponent from './base-text-component'; const INPUT_TEXT_REF = '$input-text'; +let Input = TextInput + export default class TextInputMask extends BaseTextComponent { constructor(props) { super(props); + if (props.customTextInput) Input = props.customTextInput } getElement() { @@ -19,20 +22,20 @@ export default class TextInputMask extends BaseTextComponent { _onChangeText(text) { let self = this; - if(!this._checkText(text)) { + if (!this._checkText(text)) { return; } self.updateValue(text) .then(maskedText => { - if(self.props.onChangeText) { + if (self.props.onChangeText) { self.props.onChangeText(maskedText); } }); } _checkText(text) { - if(this.props.checkText) { + if (this.props.checkText) { return this.props.checkText(this.state.value, text); } @@ -41,13 +44,13 @@ export default class TextInputMask extends BaseTextComponent { render() { return ( - this._onChangeText(text)} value={this.state.value} - /> + /> ); } }