Lists, Scrolling & User Input
Render long lists efficiently with virtualization, and build forms with text input, validation and keyboard handling.
Beginner · about 7 hours · difficulty 3/5
Learn first: Layout Systems: Flexbox, Rows, Columns & Stacks
Most apps are lists and forms. Doing both well is a core skill.
Lists
Never render hundreds of items at once. Use virtualized lists that only render what is on screen:
- React Native:
FlatList,SectionList, or FlashList for heavier lists. - Flutter:
ListView.builder. Compose:LazyColumn. SwiftUI:ListorLazyVStack.
Give each item a stable key/id so the framework can reuse rows correctly. Add pull-to-refresh, pagination (load more when near the end), and clear empty states.
Forms
- Controlled inputs: the input value lives in state and updates on every change.
- Choose keyboard types,
autoComplete/textContentTypefor autofill, andsecureTextEntryfor passwords. - Move focus to the next field on "next", submit on "done".
- Validate inline, and disable submit while a request is in flight.
- Libraries like React Hook Form (with Zod) or Flutter's
Formwidget reduce boilerplate.
Pitfalls
- Using array index as a key causes wrong rows to update after deletes.
- Putting a virtualized list inside a scroll view in the same direction breaks virtualization.
Good enough to move on: you can build a paginated list of 1,000 items that scrolls smoothly, and a validated form with good keyboard behaviour.
Key concepts
- Virtualized lists
- Stable keys for list items
- Pull to refresh and pagination
- Controlled text inputs
- Keyboard types and autofill
- Form validation
- Form libraries: React Hook Form, Formik, flutter_form_builder
Mini project
Build a contacts app with a searchable, sectioned list of 500 generated contacts and an add-contact form with validation.
Check yourself
Why is using the array index as a list item key a problem when items can be deleted?
Free resources
- React Native: FlatList (React Native)
- React Native: TextInput (React Native)
- Compose: Lists and grids (Android Developers)