File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ The following props are applicable for the component along with **props supporte
3838| containerStyle | object | Yes | {} | style for overall container. |
3939| textInputStyle | object | Yes | {} | style for text input. |
4040| testIDPrefix | string | Yes | 'otp* input* ' | testID prefix, the result will be ` otp_input_0 ` until inputCount |
41+ | autoFocus | bool | Yes | false | Input should automatically get focus when the components loads |
4142
4243#### Helper Functions
4344
Original file line number Diff line number Diff line change @@ -223,7 +223,7 @@ class OTPTextView extends Component {
223223 key = { i }
224224 autoCorrect = { false }
225225 keyboardType = { keyboardType }
226- autoFocus = { i === 0 }
226+ autoFocus = { this . props . autoFocus && i === 0 }
227227 value = { otpText [ i ] || "" }
228228 style = { inputStyle }
229229 maxLength = { this . props . inputCellLength }
@@ -260,6 +260,7 @@ OTPTextView.propTypes = {
260260 inputType : PropTypes . string ,
261261 keyboardType : PropTypes . string ,
262262 testIDPrefix : PropTypes . string ,
263+ autoFocus : PropTypes . bool
263264} ;
264265
265266OTPTextView . defaultProps = {
@@ -273,6 +274,7 @@ OTPTextView.defaultProps = {
273274 handleTextChange : ( ) => { } ,
274275 keyboardType : "numeric" ,
275276 testIDPrefix : "otp_input_" ,
277+ autoFocus : false
276278} ;
277279
278280export default OTPTextView ;
You can’t perform that action at this time.
0 commit comments