Thuta Learning
React Native
ProjectsMobile DevelopmentIntermediate

Mini Project Part 1: Todo App — Setup & UI

React NativeLesson 2830 min

What you'll walk away with

  • Explain the React and native-platform behavior of Mini Project Part 1: Todo App — Setup & UI
  • Test accessibility, failure, and lifecycle cases
  • Write maintainable, testable, and performant React Native

Explain it simply

Mini Project Part 1: Todo App — Setup & UI, in plain language

The Todo App's UI structure splits into four components: header (title), input row (TextInput + Add button), todo list (FlatList), and todo item (checkbox + text + delete button). Clearly separating each component's responsibility now makes it much easier to plug in the state logic in Part 2.

Problem → Why → Solution

The problem — why this concept matters

Cramming everything into a single component, which turns into a mess once you wire up state in Part 2 — splitting things into logical sections matters

A common mistake

Leaving out flexDirection: 'row' on the input row, so the TextInput and button don't sit side by side

Core concept — understand how it works

Evaluate Mini Project Part 1: Todo App — Setup & UI on release devices through startup, JS/UI frame rate, memory, networking, crash recovery, permissions, signing, and store requirements—not only a debug build. Recheck New Architecture and dependency compatibility on every upgrade.

Mental model
  1. project requirements
  2. components, state, and services
  3. tested UI

Explain the React and native-platform behavior of Mini Project Part 1: Todo App — Setup & UI

Core syntax or pattern

javascript
import { View, Text, TextInput, TouchableOpacity, FlatList, StyleSheet } from 'react-native';

const placeholderTodos = [
  { id: '1', text: 'Learn React Native', done: false },
  { id: '2', text: 'Build a Todo app', done: true },
];

export default function TodoApp() {
  return (
    <View style={styles.container}>
      <Text style={styles.header}>My Todo App</Text>
      <View style={styles.inputRow}>
        <TextInput style={styles.input} placeholder="Add a todo..." />
        <TouchableOpacity style={styles.addButton}>
          <Text style={styles.addButtonText}>Add</Text>
        </TouchableOpacity>
      </View>
      <FlatList
        data={placeholderTodos}
        keyExtractor={(item) => item.id}
        renderItem={({ item }) => (
          <View style={styles.todoItem}>
            <Text>{item.done ? '☑️' : '☐'} {item.text}</Text>
          </View>
        )}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: { flex: 1, padding: 16 },
  header: { fontSize: 24, fontWeight: 'bold', marginBottom: 16 },
  inputRow: { flexDirection: 'row', marginBottom: 16 },
  input: { flex: 1, borderWidth: 1, borderColor: '#ccc', borderRadius: 8, padding: 10, marginRight: 8 },
  addButton: { backgroundColor: '#3b82f6', padding: 10, borderRadius: 8, justifyContent: 'center' },
  addButtonText: { color: 'white', fontWeight: '600' },
  todoItem: { padding: 12, borderBottomWidth: 1, borderColor: '#eee' },
});

Evaluate Mini Project Part 1: Todo App — Setup & UI on release devices through startup, JS/UI frame rate, memory, networking, crash recovery, permissions, signing, and store requirements—not only a debug build. Recheck New Architecture and dependency compatibility on every upgrade.

Read the code step by step

  1. project requirementsimport { View, Text, TextInput, TouchableOpacity, Fla...

    The Todo App's UI structure splits into four components: header (title), input row (TextInput + Add button), todo list (FlatList), and todo item (checkbox + text + delete button). Clearly separating each component's responsibility now makes it much easier to plug in the state logic in Part 2.

  2. components, state, and servicesrenderItem={({ item }) => (

    Evaluate Mini Project Part 1: Todo App — Setup & UI on release devices through startup, JS/UI frame rate, memory, networking, crash recovery, permissions, signing, and store requirements—not only a debug build. Recheck New Architecture and dependency compatibility on every upgrade.

  3. tested UI});

    Test an original Mini Project Part 1: Todo App — Setup & UI example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.

Execution flow
  1. project requirements
  2. components, state, and services
  3. tested UI

Success

Explain the React and native-platform behavior of Mini Project Part 1: Todo App — Setup & UI

Failure

Cramming everything into a single component, which turns into a mess once you wire up state in Part 2 — splitting things into logical sections matters

Let's think about it this way for a moment

The Todo App's UI structure splits into four components: header (title), input row (TextInput + Add button), todo list (FlatList), and todo item (checkbox + text + delete button). Clearly separating each component's responsibility now makes it much easier to plug in the state logic in Part 2.

Let's connect it to a real scenario

Split the header, input row, and todo list into three sections using View, and use flexbox (flexDirection: row for the input row). At this stage just hardcode the state as a static array (placeholder data) — you'll wire up useState in Part 2. Use TouchableOpacity for the 'Add' button, the checkbox icon (☐/☑️), and the delete icon (🗑️).

Code Example

javascript
import { View, Text, TextInput, TouchableOpacity, FlatList, StyleSheet } from 'react-native';

const placeholderTodos = [
  { id: '1', text: 'Learn React Native', done: false },
  { id: '2', text: 'Build a Todo app', done: true },
];

export default function TodoApp() {
  return (
    <View style={styles.container}>
      <Text style={styles.header}>My Todo App</Text>
      <View style={styles.inputRow}>
        <TextInput style={styles.input} placeholder="Add a todo..." />
        <TouchableOpacity style={styles.addButton}>
          <Text style={styles.addButtonText}>Add</Text>
        </TouchableOpacity>
      </View>
      <FlatList
        data={placeholderTodos}
        keyExtractor={(item) => item.id}
        renderItem={({ item }) => (
          <View style={styles.todoItem}>
            <Text>{item.done ? '☑️' : '☐'} {item.text}</Text>
          </View>
        )}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: { flex: 1, padding: 16 },
  header: { fontSize: 24, fontWeight: 'bold', marginBottom: 16 },
  inputRow: { flexDirection: 'row', marginBottom: 16 },
  input: { flex: 1, borderWidth: 1, borderColor: '#ccc', borderRadius: 8, padding: 10, marginRight: 8 },
  addButton: { backgroundColor: '#3b82f6', padding: 10, borderRadius: 8, justifyContent: 'center' },
  addButtonText: { color: 'white', fontWeight: '600' },
  todoItem: { padding: 12, borderBottomWidth: 1, borderColor: '#eee' },
});
You should see
You'll end up with a static UI screen containing a header, an input row, and two placeholder todo items.

5-Minute Try-It

Type out this UI structure yourself and run it on Expo Go — try swapping the two placeholder items for your own todo text.

A Quick Word of Caution

Pressing the Add button or a checkbox won't do anything yet at this stage (no event handlers wired up) — it becomes interactive once we add the state logic in Part 2.

Real-world usage

How to apply it in a real project

Test an original Mini Project Part 1: Todo App — Setup & UI example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.

Mini challenge

Build it yourself

Test an original Mini Project Part 1: Todo App — Setup & UI example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.

  • Rebuild the example without copying it
  • Test a normal input and an edge case
  • Predict the compiler or output result before running it
javascript
import { View, Text, TextInput, TouchableOpacity, FlatList, StyleSheet } from 'react-native';

const placeholderTodos = [
  { id: '1', text: 'Learn React Native', done: false },
  { id: '2', text: 'Build a Todo app', done: true },
];

export default function TodoApp() {
  return (
    <View style={styles.container}>
      <Text style={styles.header}>My Todo App</Text>
      <View style={styles.inputRow}>
        <TextInput style={styles.input} placeholder="Add a todo..." />
        <TouchableOpacity style={styles.addButton}>
          <Text style={styles.addButtonText}>Add</Text>
        </TouchableOpacity>
      </View>
      <FlatList
        data={placeholderTodos}
        keyExtractor={(item) => item.id}
        renderItem={({ item }) => (
          <View style={styles.todoItem}>
            <Text>{item.done ? '☑️' : '☐'} {item.text}</Text>
          </View>
        )}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: { flex: 1, padding: 16 },
  header: { fontSize: 24, fontWeight: 'bold', marginBottom: 16 },
  inputRow: { flexDirection: 'row', marginBottom: 16 },
  input: { flex: 1, borderWidth: 1, borderColor: '#ccc', borderRadius: 8, padding: 10, marginRight: 8 },
  addButton: { backgroundColor: '#3b82f6', padding: 10, borderRadius: 8, justifyContent: 'center' },
  addButtonText: { color: 'white', fontWeight: '600' },
  todoItem: { padding: 12, borderBottomWidth: 1, borderColor: '#eee' },
});

Expected: Explain the React and native-platform behavior of Mini Project Part 1: Todo App — Setup & UI

Show hint

Test an original Mini Project Part 1: Todo App — Setup & UI example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.

Quick quiz 1 / 3

What best describes the core idea of Mini Project Part 1: Todo App — Setup & UI?

Quick quiz 2 / 3

Which mistake should you avoid first?

Quick quiz 3 / 3

How should this be applied in a real project?

What to remember

  • project requirements → components, state, and services → tested UI
  • Evaluate Mini Project Part 1: Todo App — Setup & UI on release devices through startup, JS/UI frame rate, memory, networking, crash recovery, permissions, signing, and store requirements—not only a debug build. Recheck New Architecture and dependency compatibility on every upgrade.
  • Cramming everything into a single component, which turns into a mess once you wire up state in Part 2 — splitting things into logical sections matters
  • Test an original Mini Project Part 1: Todo App — Setup & UI example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.

React Native Documentation — React Native

Easy traps

  • Cramming everything into a single component, which turns into a mess once you wire up state in Part 2 — splitting things into logical sections matters
  • Leaving out flexDirection: 'row' on the input row, so the TextInput and button don't sit side by side
  • Assuming one simulator's happy path proves every real-device, release-build, permission, accessibility, offline, and lifecycle path.

Hands-on Exercise

Test an original Mini Project Part 1: Todo App — Setup & UI example on Android and iOS with small and large screens, font scaling, dark mode, keyboard and screen reader use, slow/offline networking, denied permissions, and background/foreground transitions. Use DevTools, tests, and a release build where relevant.

You'll know it worked when: You'll end up with a static UI screen containing a header, an input row, and two placeholder todo items.

Updated on

Progress is saved only in this browser on this device. It isn't synced to other devices.

Report a problem with this lessonOpens your email app with this lesson's address filled in — nothing is sent until you send it.

Mini Project Part 1: Todo App — Setup & UI | Thuta Learning