From 4b401e232e6a5ef04c7cdeb662df93b7f00fa29b Mon Sep 17 00:00:00 2001 From: Salar Abbasi Date: Sat, 24 Aug 2019 15:17:31 +0430 Subject: [PATCH] Add onChange function --- components/ConfirmationCodeInput.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/components/ConfirmationCodeInput.js b/components/ConfirmationCodeInput.js index 239c85a..ebfeb8c 100644 --- a/components/ConfirmationCodeInput.js +++ b/components/ConfirmationCodeInput.js @@ -22,6 +22,7 @@ export default class ConfirmationCodeInput extends Component { codeInputStyle: TextInput.propTypes.style, containerStyle: viewPropTypes.style, onFulfill: PropTypes.func, + onChangeText: PropTypes.func, }; static defaultProps = { @@ -87,7 +88,8 @@ export default class ConfirmationCodeInput extends Component { newCodeArr[i] = ''; } } - + + this.props.onChangeText(newCodeArr) this.setState({ codeArr: newCodeArr, currentIndex: index @@ -202,7 +204,7 @@ export default class ConfirmationCodeInput extends Component { } _onInputCode(character, index) { - const { codeLength, onFulfill, compareWithCode, ignoreCase } = this.props; + const { codeLength, onFulfill, compareWithCode, ignoreCase, onChangeText } = this.props; let newCodeArr = _.clone(this.state.codeArr); newCodeArr[index] = character; @@ -220,7 +222,8 @@ export default class ConfirmationCodeInput extends Component { } else { this._setFocus(this.state.currentIndex + 1); } - + + onChangeText(newCodeArr) this.setState(prevState => { return { codeArr: newCodeArr,