Skip to content

feat(otp): add OtpField, a verification code input with SMS autofill, plus migration guides - #83

Merged
elik56a merged 2 commits into
masterfrom
feat/otp-field
Oct 29, 2026
Merged

elik56a merged 2 commits into
masterfrom
feat/otp-field

Conversation

@eliyahu-kriel

Copy link
Copy Markdown
Collaborator

OtpField

A one-time code in a box per character, for the step after PhoneField in a phone sign-in.

  • One hidden TextInput lies over the boxes, so typing, long-press paste, screen readers and SMS autofill all work: oneTimeCode on iOS and the web, sms-otp on Android.
  • A pasted message keeps only the code: Your code is 482-913 fills 482913.
  • Props: length (6), inputMode (numeric | text), secureTextEntry, autoFocus, disabled, accessibilityLabel. onChange fires on user changes only, and onComplete once the last box is filled.
  • The boxes reuse FIELD_DESIGN, so they look like each design's text fields, with a blinking caret in the next box. Slots: container, cell, focusedCell, filledCell, cellText, caret.
  • caretHidden is left off on purpose: it hides Android's paste menu.
  • Not included: a ref (clear with value='', hide the keyboard with Keyboard.dismiss() in onComplete) and an error prop (a red border is one styles.cell override; the docs show it).

Migration guides

New guides for libraries with high weekly downloads that had none:

  • @react-native-community/slider
  • @ptomasroos/react-native-multi-slider
  • react-native-otp-entry
  • react-native-confirmation-code-field
  • react-native-ui-datepicker

Prop mappings follow each library's current README.

Docs

Component page with a playground, catalog, live controls, home grid and Hero, API reference, the designs, styling and typescript guides, intro, the AI cheat sheet, README, and the SEO descriptions and keywords.

Checks

  • pnpm lint, pnpm typecheck and pnpm test (693 tests) pass.
  • pnpm docs:build passes with no broken links.
  • Not checked on a device yet: SMS autofill needs a real iPhone and Android phone.

🤖 Generated with Claude Code

elik56a and others added 2 commits October 29, 2026 22:34
… plus migration guides

OtpField takes a one-time code in a box per character. One hidden TextInput
lies over the boxes, so typing, long-press paste, screen readers and the code
the OS offers from a text message all work (oneTimeCode on iOS and the web,
sms-otp on Android). A pasted message keeps only the code's characters. It
takes length, numeric or text input, secure dots for a PIN, autoFocus and
disabled; onChange fires on user changes and onComplete once the last box is
filled. The boxes are drawn like each design's text fields, with a blinking
caret in the next one.

New migration guides map @react-native-community/slider,
@ptomasroos/react-native-multi-slider, react-native-otp-entry,
react-native-confirmation-code-field and react-native-ui-datepicker to the
library.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
useOtpField's inferred return held React Native's internal AnimatedValue, which
tsc can't name in the declarations (TS2883). It now returns OtpFieldState, and
useCaretBlink an Animated.Value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@elik56a
elik56a merged commit de3ccad into master Oct 29, 2026
5 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants