Skip to main content
The TextInput component is the fundamental way to get text input from users in React Native. This guide covers everything you need to know about handling text input.

Basic TextInput

The simplest form of text input:
Always control your TextInput with value and onChangeText. This makes it a “controlled component” that React can manage.

Common TextInput Props

Keyboard Types

Different keyboards for different input types:

Secure Text Entry

For passwords and sensitive data:

Multiline Text

For longer text input:

Platform-Specific Behavior

TextInput has different behaviors on iOS and Android, as seen in the React Native source:
  • Uses UITextField for single-line
  • Uses UITextView for multiline
  • returnKeyType affects keyboard appearance
  • clearButtonMode shows clear button

Complete Login Form Example

Real-world form with validation:

Advanced Features

Managing Focus

Auto-advancing Forms

Input Events

TextInput provides several event handlers:

Keyboard Configuration

1

Set Return Key Type

2

Handle Submit

3

Enable/Disable Return Key

Common Patterns

Search Input

Best Practices

Use value and onChangeText props to keep input state in sync with React state.
Use keyboardType to show the right keyboard for the input type (email, phone, number, etc.).
Set autoCorrect={false} and autoCapitalize="none" for email and username inputs.
Style inputs differently for focus, error, and disabled states.
Never display passwords in plain text.

Next Steps

Using Lists

Learn to render search results and data lists

Platform-Specific Code

Handle iOS and Android differences