From f43850ae874d5fa92af43aadb5c55d2b4c5b4af0 Mon Sep 17 00:00:00 2001 From: Web & Mobile Developer Date: Tue, 12 Dec 2017 23:57:06 +0400 Subject: [PATCH 1/4] getCode() added This is for getting Code on current state --- components/ConfirmationCodeInput.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/ConfirmationCodeInput.js b/components/ConfirmationCodeInput.js index 4e11ce0..989667f 100644 --- a/components/ConfirmationCodeInput.js +++ b/components/ConfirmationCodeInput.js @@ -102,6 +102,10 @@ export default class ConfirmationCodeInput extends Component { }) this._setFocus(0) } + getCode = () => { + var code = this.state.codeArr.fill('') + return code + } _setFocus = (index) => this.codeInputRefs[index].focus() @@ -201,4 +205,4 @@ const styles = StyleSheet.create({ padding: 0, }, }) - \ No newline at end of file + From 5e8765570e13b1f13fa73a13627255df129fdde3 Mon Sep 17 00:00:00 2001 From: Web & Mobile Developer Date: Tue, 12 Dec 2017 23:58:38 +0400 Subject: [PATCH 2/4] update ReadMe for getCode function --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d77261..6b32b1b 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,16 @@ this.refs.refName.clear(); ref="refName" /> ``` + +getCode input: +```javascript +this.refs.refName.getCode(); +... + +``` ## Example See [EXAMPLE](example) ```sh @@ -111,4 +121,4 @@ react-native run-ios / react-native run-android react-native-code-input is released under the MIT license. See [LICENSE](LICENSE) for details. -Any question or support will welcome. \ No newline at end of file +Any question or support will welcome. From a29b19146371878ad81bc263363f9a45bd83940f Mon Sep 17 00:00:00 2001 From: Web & Mobile Developer Date: Wed, 13 Dec 2017 00:12:09 +0400 Subject: [PATCH 3/4] update function --- components/ConfirmationCodeInput.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/ConfirmationCodeInput.js b/components/ConfirmationCodeInput.js index 989667f..b2b4bf1 100644 --- a/components/ConfirmationCodeInput.js +++ b/components/ConfirmationCodeInput.js @@ -103,8 +103,7 @@ export default class ConfirmationCodeInput extends Component { this._setFocus(0) } getCode = () => { - var code = this.state.codeArr.fill('') - return code + return this.state.currentIndex } _setFocus = (index) => this.codeInputRefs[index].focus() From ebe59371688b787f832d8c8eb16ae9cce408ae1a Mon Sep 17 00:00:00 2001 From: Web & Mobile Developer Date: Wed, 13 Dec 2017 19:14:38 +1000 Subject: [PATCH 4/4] Update for React Native version up --- components/ConfirmationCodeInput.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/ConfirmationCodeInput.js b/components/ConfirmationCodeInput.js index b2b4bf1..b102f82 100644 --- a/components/ConfirmationCodeInput.js +++ b/components/ConfirmationCodeInput.js @@ -67,7 +67,7 @@ export default class ConfirmationCodeInput extends Component { codeInputStyle: TextInput.propTypes.style, containerStyle: View.propTypes.style, onFulfill: PropTypes.func, - inputComponent: React.PropTypes.func, + inputComponent: PropTypes.func, keyboardType: TextInput.propTypes.keyboardType, }