React Native TextInput Props, Searchable

TextInput is the core React Native component for typed text. Keep its value in state and update it from onChangeText, which hands you the new string. For a textarea, set multiline to true and add textAlignVertical: "top" so Android matches iOS. keyboardType, autoComplete and secureTextEntry pick the keyboard, autofill hint and password masking.

TextInput props for the most common fields
FieldProps
EmailkeyboardType="email-address" autoComplete="email" autoCapitalize="none"
PasswordsecureTextEntry autoComplete="password" textContentType="password"
Textareamultiline numberOfLines={4} textAlignVertical="top"
PricekeyboardType="decimal-pad"
One-time codekeyboardType="number-pad" autoComplete="one-time-code" maxLength={6}

Updated

The official reference is one long alphabetical list. This page keeps the ones people search for, with their real values and defaults, in a table you can filter by name, value or platform. Type multiline, password or android into the box to narrow it.

Filter the props

TextInput props, values and defaults
PropValues or typeDefaultPlatformWhat it does
value / onChangeTextstring / (text) => voidBothControlled text and the callback that receives each new string
defaultValuestringBothInitial text when you do not control the value
placeholderstringBothHint shown while the field is empty
placeholderTextColorcolorBothColour of the placeholder text
multilineboolfalseBothAllows several lines; the textarea of React Native
numberOfLinesnumberBothMaximum lines to show; on iOS only with the New Architecture
keyboardTypedefault, number-pad, decimal-pad, numeric, email-address, phone-pad, urlBothWhich keyboard opens
keyboardType (iOS)ascii-capable, numbers-and-punctuation, name-phone-pad, twitter, web-searchiOSExtra keyboards only iOS offers
keyboardType (Android)visible-passwordAndroidA keyboard with no suggestions
inputModenone, text, decimal, numeric, tel, search, email, urlBothLike the HTML inputmode attribute; wins over keyboardType
secureTextEntryboolfalseBothMasks the text; does not work with multiline
autoCompleteemail, password, username, new-password, one-time-code, off and moreBothAutofill hint for the system; off disables it
textContentTypepassword, newPassword, oneTimeCode, emailAddress, username, none and moreiOSTells iOS what the field holds for keychain and code autofill
passwordRulesstringiOSRequirements for generated passwords when textContentType is newPassword
autoCapitalizecharacters, words, sentences, nonesentencesBothWhich letters become capitals automatically
autoCorrectbooltrueBothTurns auto-correct on or off
maxLengthnumberBothStops input at this many characters
editablebooltrueBothfalse makes the field read only
readOnlyboolfalseBothtrue makes the field read only; an alternative to editable
returnKeyTypedone, go, next, search, sendBothLabel of the Return key; more values exist per platform
onSubmitEditing({nativeEvent}) => voidBothRuns when the submit key is pressed; not called for phone-pad on iOS
submitBehaviorsubmit, blurAndSubmit, newlineblurAndSubmit (single line), newline (multiline)BothWhat Return does; replaces blurOnSubmit
blurOnSubmitboolBothDeprecated in favour of submitBehavior
underlineColorAndroidcolorAndroidColour of the default bottom border; transparent hides it

TextInput examples

A multiline textarea

textAlignVertical keeps the cursor at the top on Android, and the character count reads straight from state.

import { useState } from "react";
import { Text, TextInput, View } from "react-native";

export function Notes() {
  const [text, setText] = useState("");
  return (
    <View>
      <Text>Notes</Text>
      <TextInput
        accessibilityLabel="Notes"
        value={text}
        onChangeText={setText}
        multiline
        numberOfLines={4}
        maxLength={500}
        style={{ minHeight: 100, textAlignVertical: "top", borderWidth: 1, borderRadius: 8, padding: 10 }}
      />
      <Text>{text.length}/500</Text>
    </View>
  );
}

Email field that moves focus to the next field

returnKeyType="next" labels the key, and onSubmitEditing focuses the password field through its ref.

import { useRef, useState } from "react";
import { TextInput } from "react-native";

export function LoginFields() {
  const [email, setEmail] = useState("");
  const [password, setPassword] = useState("");
  const passwordRef = useRef(null);
  return (
    <>
      <TextInput
        value={email}
        onChangeText={setEmail}
        placeholder="Email"
        keyboardType="email-address"
        autoComplete="email"
        autoCapitalize="none"
        returnKeyType="next"
        submitBehavior="submit"
        onSubmitEditing={() => passwordRef.current?.focus()}
      />
      <TextInput
        ref={passwordRef}
        value={password}
        onChangeText={setPassword}
        placeholder="Password"
        secureTextEntry
        autoComplete="password"
        textContentType="password"
        returnKeyType="done"
      />
    </>
  );
}

Controlled or uncontrolled

Most screens pass value and onChangeText, so state always holds what is on screen and you can validate or reformat it. defaultValue gives an initial string without tracking each keystroke, which suits a field you read only once, on submit.

Reach for a ref when you need to move focus. Calling focus() on the next field's ref inside onSubmitEditing gives you the familiar tap Return to move down a form behaviour.

Keyboards and autofill

keyboardType changes the keys a person sees; it never validates what they type. A decimal-pad field can still receive pasted letters, so check the string before you save it.

autoComplete is the cross-platform hint for the system's autofill, and textContentType is the iOS-only one. Setting both on login fields lets saved passwords and one-time codes from messages fill in on either platform.

How it works

  1. Type a word in the filter box: a prop name, a value such as decimal-pad, or a platform.
  2. Rows that match anywhere stay visible; the count under the box tells you how many.
  3. Read the default column before you set a prop; several defaults surprise people.
  4. Copy the examples below the table for a textarea, an email field and a next-field chain.

Tips

Frequently asked questions

How do I make a textarea in React Native?

There is no separate textarea component. Use TextInput with multiline set to true, give it a height or numberOfLines, and add textAlignVertical: "top" so the first line starts at the top on Android as it does on iOS.

Why does the Return key add a new line instead of submitting?

On a multiline field submitBehavior defaults to "newline". Set it to "submit" or "blurAndSubmit" if Return should fire onSubmitEditing instead. Single-line fields default to "blurAndSubmit".

What replaced blurOnSubmit?

submitBehavior. The docs mark blurOnSubmit as deprecated, and submitBehavior overrides it when both are present.

Which keyboardType values work on both platforms?

default, number-pad, decimal-pad, numeric, email-address, phone-pad and url. Others, such as twitter and web-search on iOS or visible-password on Android, only apply to one platform.

Related: React Native forms and validation, React Native password input, HTML input type number, React vs React Native, React with TypeScript.

Start for free or see all free tools. We.Inc is free to start, with no card needed. AI building is on paid plans from $20 a month.

More in Guides

We.Inc is an AI-powered website builder you can resell under your own brand. Launch a branded client dashboard, bill on Stripe Connect, and deliver AI-generated websites in minutes. White-label plans start at $99 a month for 25 client sites, with a 7-day free trial and no per-site fees.

Product

Who It's For

Features

Resources

Company

View Sitemap