Mobile development

Stage 2 · Lesson 8 of 10

TextInput, forms and the keyboard

React and React Native components

A TextInput is usually controlled: its value comes from state, and onChangeText updates that state. Set keyboardType for email or numbers and secureTextEntry for passwords. Set autoCapitalize="none" for emails, and textContentType and autoComplete so password managers work.

Use returnKeyType with onSubmitEditing and a ref to move focus to the next field. The keyboard covers the bottom of the screen. So wrap in KeyboardAvoidingView, or a scroll view that keeps the field being typed in visible.

For larger forms, react-hook-form with a library such as handles validation well.

Common traptesting only on iOS, where keyboard behaviour differs from Android, and finding the submit button hidden.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

  • GuideFree
    Expo Documentation

    Expo

    The Expo tutorial builds a small app you run on your own phone

  • GuideFree
    React Documentation

    Meta

    "Describing the UI" and "Adding interactivity" cover the React you need

Practise

  • Use a free challenge's mobile design image as the spec for a native screen

Keep handy

Mark this stage as not done?