Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ this.refs.refName.clear();
ref="refName"
/>
```

getCode input:
```javascript
this.refs.refName.getCode();
...
<CodeInput
...
ref="refName"
/>
```
## Example
See [EXAMPLE](example)
```sh
Expand All @@ -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.
Any question or support will welcome.
7 changes: 5 additions & 2 deletions components/ConfirmationCodeInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down Expand Up @@ -102,6 +102,9 @@ export default class ConfirmationCodeInput extends Component {
})
this._setFocus(0)
}
getCode = () => {
return this.state.currentIndex
}

_setFocus = (index) => this.codeInputRefs[index].focus()

Expand Down Expand Up @@ -201,4 +204,4 @@ const styles = StyleSheet.create({
padding: 0,
},
})