react-native how to move to next input after onpress "tab" key on keyboard

Viewed 341

I used useRef to move to next input like this.

const passwordRef = useRef();
const onNext = (nextOne) => {
      nextOne?.current?.focus();
    };
...
return (
 <TextInput
          value={watch("username")}
          placeholder="Input Id"
          returnKeyType="next"
          autoCapitalize="none"
          placeholderTextColor={"rgba(255, 255, 255, 0.6)"}
          onSubmitEditing={() => onNext(passwordRef)}
          onChangeText={(text) => setValue("username", text)}
        />

it worked with "enter" key, but I want to move to next input using "tab" key on the keyboard. Is there any way to implement this?

0 Answers
Related