OTPInput draws one field per digit of a one-time code. Each digit moves focus to the next field, and backspace in an empty field goes back to the one before. A code pasted into a field, or filled in from a text message, spreads across the fields from that one. onComplete gets the code once every field has a digit. See the web OTPInput for the browser version.
error draws every field in the danger colour. errorMessage shows under the fields and is announced when it appears.
- The first field sets textContentType="oneTimeCode" and autoComplete="sms-otp", so iOS and Android offer the code from a text message above the keyboard.
- A pasted or autofilled code fills the following fields. On the web each field takes one character.
- Each field is 56 points wide, not 48, to leave room for the field's side padding around a large digit.
- The keyboard is a number pad. There are no arrow keys, so moving between fields is by tapping one.
- OTPInput does not take the web's div props. Use style for the outer view.