CHANGED, STILL NO ANSWER I followed this example: https://jsfiddle.net/4np9u17g/11/ I want to make it like there - after inputing value focus should go to next input. I use new syntax of refs and redux form, what am i doing wrong?
constructor() {
super();
this.field1 = React.createRef();
this.field2 = React.createRef();
this.field3 = React.createRef();
this.field4 = React.createRef();
this.field5 = React.createRef();
this.field6 = React.createRef();
}
On change function (I made it really simple for now):
onChange = (text) => {
if (text.length === 1) {
this.field3.focus();
}
};
Input component:
InputComponent = ({ input, meta, ...rest }) => (
<Input {...rest} keyboardType="numeric" maxLength={1} value={input.value} onChangeText={input.onChange} />
);
And finally one of my redux form fields:
<Field
maxLength={
id="2"
ref={this.field1}
style={styles.input}
name="pinSix1"
component={this.InputComponent}
placeholder="*"
onChange={this.onChange}
secureTextEntry
/>
<Field
id="3"
ref={this.field2}
style={styles.input}
name="pinSix2"
component={this.InputComponent}
placeholder="*"
onChange={this.onChange}
secureTextEntry
/>
And I get an error
undefined is not a function (evaluating '_this.field3.focus()')