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. diff --git a/components/ConfirmationCodeInput.js b/components/ConfirmationCodeInput.js index 4e11ce0..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, } @@ -102,6 +102,9 @@ export default class ConfirmationCodeInput extends Component { }) this._setFocus(0) } + getCode = () => { + return this.state.currentIndex + } _setFocus = (index) => this.codeInputRefs[index].focus() @@ -201,4 +204,4 @@ const styles = StyleSheet.create({ padding: 0, }, }) - \ No newline at end of file +