RORK LABJP
ENGINE — Rork Max is powered by Claude Code and Claude Opus 4.6, generating native Swift apps directlyCORE ML — Rork Max reaches on-device Core ML inference alongside HealthKit, HomeKit, NFC, and App ClipsSEED — Rork raised a $15M seed led by Left Lane Capital in April 2026, joined by Peak XV and a16z SpeedrunM&A — Rork acquired the app builder Paperline and says it will stay acquisitive to bring in engineering talentMARKET — Gartner expects 75% of new applications to be built with low-code or no-code tools by the end of 2026GROWTH — The no-code AI platform market is projected to grow from $4.9B in 2024 to $24.8B by 2029ENGINE — Rork Max is powered by Claude Code and Claude Opus 4.6, generating native Swift apps directlyCORE ML — Rork Max reaches on-device Core ML inference alongside HealthKit, HomeKit, NFC, and App ClipsSEED — Rork raised a $15M seed led by Left Lane Capital in April 2026, joined by Peak XV and a16z SpeedrunM&A — Rork acquired the app builder Paperline and says it will stay acquisitive to bring in engineering talentMARKET — Gartner expects 75% of new applications to be built with low-code or no-code tools by the end of 2026GROWTH — The no-code AI platform market is projected to grow from $4.9B in 2024 to $24.8B by 2029
Articles/App Dev
App Dev/2026-07-05Intermediate

Building a One-Time Code Field in Expo — SMS Autofill and Segmented Display Together

A six-digit verification screen looks trivial, but once you account for SMS autofill, pasting, and deleting one digit at a time, it needs real care. Here is how to nail the iOS and Android autofill first, then build a segmented look on top of a single TextInput that does not break.

Rork498Expo139React Native201Authentication8UX Design9

Premium Article

When I added phone verification to one of my apps, my first attempt was the obvious one: six TextInputs sitting side by side. It looked tidy, but the feedback arrived fast. "The code from the SMS never shows up above the keyboard." "When I paste, only the first box fills in." The moment I split the field into boxes, I had quietly broken both iOS autofill and clipboard paste. As an indie developer shipping several apps to the App Store, this one screen — the verification code field — is something I have rebuilt more times than I would like to admit.

A code entry screen sits right before sign-up or payment, exactly where you least want people to drop off. A single moment of friction here loses someone who was already interested. Let me walk through building an input in Expo (React Native) where SMS autofill, pasting, and deleting all feel natural.

Splitting into boxes cuts off autofill

The first snag in a code field is the mismatch between how it looks and how input actually works. Visually you want each digit in its own box. But OS autofill treats one field as the target and tries to drop the whole six-digit string into it.

Split that into six TextInputs and iOS cannot decide which field to inject into, so the keyboard suggestion (the code chip) never appears at all. Android's SMS autofill assumes a single field too. Paste lands only in the one focused box.

That leads to a single guiding principle: split the appearance, keep the input as one. Place a single transparent TextInput, then draw its value one character at a time so it reads as a row of boxes.

Set the autofill attributes first

Lock down autofill before anything else. Leave it for later and you will build the whole UI, then lose an afternoon to "why is the suggestion not showing." The required attributes differ by OS.

GoaliOSAndroid
Code autofilltextContentType="oneTimeCode"autoComplete="sms-otp"
Keyboard typekeyboardType="number-pad" (for numeric codes)
Suppress autocorrectautoCorrect={false}; let textContentType take priority

One caution: copying an importantForAutofill value from an old blog post can actually make Android ignore sms-otp. Start from the minimal setup above and add attributes only when you truly need them.

import { TextInput } from "react-native";
 
// The single real input. It stays transparent because the boxes are drawn separately
<TextInput
  value={code}
  onChangeText={handleChange}
  keyboardType="number-pad"
  textContentType="oneTimeCode" // iOS: surfaces the SMS code as a suggestion
  autoComplete="sms-otp"        // Android: SMS autofill
  maxLength={6}
  autoFocus
  style={{ position: "absolute", opacity: 0 }}
/>

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
The correct way to make iOS textContentType=oneTimeCode and Android autoComplete=sms-otp both fire
The pattern of looking like six boxes while actually being one TextInput, so autofill and paste keep working
Key handling that survives both a full six-digit paste and deleting one character at a time
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

App Dev2026-06-27
Before You Ask 'Are You Sure?' — Consider an Undoable Delete
Showing a confirmation dialog every time someone removes a list item trains them to tap OK without reading. Here is how to build an undoable delete in a Rork (Expo) app, and where confirmation dialogs still belong.
App Dev2026-07-07
Laying Out Variable-Height Images in Two Columns: A Masonry Wallpaper Gallery in a Rork Expo App
From why numColumns cannot pack variable-aspect images cleanly, to a dependency-free column-balancing algorithm, to keeping virtualization with FlashList masonry and a pragmatic no-dependency fallback, building a wallpaper gallery with real code.
App Dev2026-06-29
Clipboard UX in Expo apps — copy and paste without flooding users with iOS's paste banner
When you wire up copy and paste with expo-clipboard, iOS's paste permission banner can fire constantly and quietly erode trust. Here's exactly when the banner appears, and how hasStringAsync lets you gate a Paste button without ever reading the contents.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →