The Mobile Apps Picture Book
NativeSwift · Kotlinbest fit + speedtwo codebases Cross-platformReact NativeFlutter · Expoone codebase Web / PWAHTML · CSS · JSno app storelimited device access How to choose need top graphics, deep OS features, or one platform only → native small team, both platforms, mostly standard UI → cross-platform (Expo is a great start) content, forms, internal tools → a responsive web app or PWA the right answer follows your team's skills and the app's needs
PLATE 0 — Three roads to the same phone. Choose by team, budget, and what the app must do.
A picture book for grown-ups · with code

Building Mobile Apps

Nine spreads on mobile development: how phones run apps, UI and navigation, state, data and offline, native features, performance, testing, and publishing to the stores. Examples use React Native with Expo.

Say it like a pro

"Expo and React Native with typed navigation, server state in React Query, offline-first storage, OTA updates, and CI builds through EAS."

Use the tabs or the ← → keys.

not running foreground background suspended the OS can kill you any time to free memory A phone is not a small laptop touch and gestures · one app at a time · small, varied screens (notch, foldables) battery and heat limits background work · memory is tight network comes and goes (subway, lifts, weak signal) users grant permissions one at a time, and can say no So design for… save state often · resume cleanly · work offline · ask for permission in context thumb reach · big tap targets (44–48 pt) · accessibility (VoiceOver / TalkBack)
PLATE 1 — Your app can be paused, killed and restarted at any moment. Plan for it.
Chapter 1 · How mobile differs

Lifecycle, constraints, and your first app

$ node -v                                  # Node 20+
$ npx create-expo-app@latest my-app --template blank-typescript
$ cd my-app && npx expo start              # scan the QR with the Expo Go app on your phone
$ npx expo start --ios ; npx expo start --android      # simulator / emulator (needs Xcode / Android Studio)
// App.tsx: the smallest useful screen
import { useState } from "react";
import { View, Text, Pressable, StyleSheet } from "react-native";

export default function App() {
  const [count, setCount] = useState(0);
  return (
    <View style={styles.container}>
      <Text style={styles.title}>Taps: {count}</Text>
      <Pressable accessibilityRole="button" onPress={() => setCount(c => c + 1)} style={styles.button}>
        <Text style={styles.buttonText}>Tap me</Text>
      </Pressable>
    </View>
  );
}
const styles = StyleSheet.create({
  container: { flex: 1, alignItems: "center", justifyContent: "center", gap: 16 },
  title: { fontSize: 28, fontWeight: "700" },
  button: { backgroundColor: "#2f5bea", paddingVertical: 14, paddingHorizontal: 28, borderRadius: 12 },
  buttonText: { color: "white", fontSize: 18 },
});
Say it like a pro

"Assume the OS can kill the app any time, so state is saved and restored, and everything works offline first."

safe area (notch) header FlatList (scrolls) tab bar unitsdp / pt, not pxscales per screendensity: 1×–4× flex rulescolumn by defaultflex:1 = fill spacegap, padding, marginjustifyContent (main)alignItems (cross)
PLATE 2 — Build screens as flexible columns that adapt to any device.
Chapter 2 · UI, layout & lists

Components, styles, and scrolling lists

import { FlatList, View, Text, SafeAreaView, Image, ActivityIndicator } from "react-native";

type Task = { id: string; title: string; done: boolean };

function TaskRow({ task }: { task: Task }) {
  return (
    <View style={{ flexDirection: "row", alignItems: "center", padding: 16, gap: 12 }}>
      <Text style={{ fontSize: 18, textDecorationLine: task.done ? "line-through" : "none" }}>{task.title}</Text>
    </View>
  );
}

export function TaskList({ tasks, loading }: { tasks: Task[]; loading: boolean }) {
  if (loading) return <ActivityIndicator />;
  return (
    <SafeAreaView style={{ flex: 1 }}>
      <FlatList
        data={tasks}
        keyExtractor={t => t.id}
        renderItem={({ item }) => <TaskRow task={item} />}
        ListEmptyComponent={<Text style={{ padding: 24 }}>Nothing yet. Add a task.</Text>}
        ItemSeparatorComponent={() => <View style={{ height: 1, backgroundColor: "#8884" }} />}
      />
    </SafeAreaView>
  );
}
  • FlatList, not ScrollView + map, for long lists: it renders only what's on screen.
  • Use platform conventions: Material on Android, Human Interface Guidelines on iOS.
  • Support dark mode (useColorScheme), large text, and screen readers (accessibilityLabel).
  • Handle the keyboard (KeyboardAvoidingView) and safe areas.
Say it like a pro

"FlatList for lists, safe areas respected, dark mode and accessibility labels from the start."

APIserver truth query cacheReact Query screensrender data disk storage Put each kind of state in the right place UI state (modal open, input text) → useState in the component shared app state (theme, signed-in user) → context or Zustand server data (tasks, profile) → React Query: caching, retries, refetch on focus must survive restart → AsyncStorage / SQLite / MMKV · secrets → SecureStore (Keychain/Keystore) never keep tokens or passwords in plain AsyncStorage
PLATE 4 — Don't copy server data into your own global store. Let a cache own it.
Chapter 4 · State, networking & storage

Fetching data and keeping it

$ npx expo install @tanstack/react-query expo-secure-store @react-native-async-storage/async-storage zustand
import { QueryClient, QueryClientProvider, useQuery, useMutation } from "@tanstack/react-query";
import * as SecureStore from "expo-secure-store";

const API = process.env.EXPO_PUBLIC_API_URL;                       // set in .env; EXPO_PUBLIC_ is bundled into the app (public!)

async function api<T>(path: string, init?: RequestInit): Promise<T> {
  const token = await SecureStore.getItemAsync("token");
  const res = await fetch(API + path, { ...init, headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}`, ...init?.headers } });
  if (!res.ok) throw new Error(`HTTP ${res.status}`);
  return res.json();
}

export function useTasks() {
  return useQuery({ queryKey: ["tasks"], queryFn: () => api<Task[]>("/tasks"), staleTime: 30_000 });
}
export function useAddTask(qc: QueryClient) {
  return useMutation({
    mutationFn: (title: string) => api<Task>("/tasks", { method: "POST", body: JSON.stringify({ title }) }),
    onSuccess: () => qc.invalidateQueries({ queryKey: ["tasks"] }),   // refetch the list
  });
}
secrets
anything in the app bundle can be extracted. Never embed API secrets; keep them on your server.
optimistic update
show the change instantly, roll back if the server rejects it
forms
react-hook-form + zod for validation
Say it like a pro

"React Query for server state, SecureStore for tokens, and no secrets inside the binary."

UI local DB sync queueretry later online Rules for apps that work on a train write to the local DB first; the UI never waits on the network queue mutations with a client-generated ID; the server dedupes (idempotent) sync on reconnect, on app foreground, and on a schedule Conflicts last-write-wins (simple) · per-field merge · CRDTs for collaborative data show sync state: "saved on device · syncing · offline" tools: SQLite (expo-sqlite) · WatermelonDB · Realm · PowerSync · Firebase
PLATE 5 — The network is optional. The local database is the source the UI trusts.
Chapter 5 · Offline & sync

Make it work with no signal

import * as SQLite from "expo-sqlite";
import NetInfo from "@react-native-community/netinfo";

const db = await SQLite.openDatabaseAsync("app.db");
await db.execAsync(`
  CREATE TABLE IF NOT EXISTS tasks (id TEXT PRIMARY KEY, title TEXT NOT NULL, done INTEGER DEFAULT 0, updated_at INTEGER);
  CREATE TABLE IF NOT EXISTS outbox (id TEXT PRIMARY KEY, op TEXT NOT NULL, payload TEXT NOT NULL);
`);

async function addTask(title: string) {
  const id = crypto.randomUUID();                                  // client-made ID → safe to retry
  await db.runAsync("INSERT INTO tasks (id, title, updated_at) VALUES (?, ?, ?)", id, title, Date.now());
  await db.runAsync("INSERT INTO outbox (id, op, payload) VALUES (?, 'create_task', ?)", id, JSON.stringify({ id, title }));
  void flushOutbox();                                              // try now; harmless if offline
}

async function flushOutbox() {
  if (!(await NetInfo.fetch()).isConnected) return;
  for (const row of await db.getAllAsync<{ id: string; payload: string }>("SELECT * FROM outbox")) {
    const res = await fetch(`${API}/tasks`, { method: "POST", headers: { "Idempotency-Key": row.id }, body: row.payload });
    if (res.ok) await db.runAsync("DELETE FROM outbox WHERE id = ?", row.id);
    else break;                                                    // stop, retry later
  }
}
NetInfo.addEventListener(s => { if (s.isConnected) void flushOutbox(); });
Say it like a pro

"Local-first writes with an outbox, idempotency keys, sync on reconnect, and visible sync status."

Camera Location Biometrics Notifications Files / photos Sensors Ask in context, explain why, handle "no""Allow location to show stores near you" → only when they tap Find stores Push notification path your server APNs / FCM device device registers for a push token → you store it → server sends via Expo/FCM/APNs
PLATE 6 — The phone's sensors and services are what make an app feel native.
Chapter 6 · Device features & permissions

Camera, location, push, biometrics

$ npx expo install expo-camera expo-location expo-notifications expo-local-authentication expo-image-picker
import * as Location from "expo-location";
import * as Notifications from "expo-notifications";
import * as LocalAuth from "expo-local-authentication";

async function nearbyStores() {
  const { status } = await Location.requestForegroundPermissionsAsync();
  if (status !== "granted") return showFallback("Enter your postcode instead");   // handle denial gracefully
  const pos = await Location.getCurrentPositionAsync({ accuracy: Location.Accuracy.Balanced });
  return fetchStores(pos.coords.latitude, pos.coords.longitude);
}

async function registerForPush() {
  const { status } = await Notifications.requestPermissionsAsync();
  if (status !== "granted") return null;
  const token = (await Notifications.getExpoPushTokenAsync()).data;   // send this to your server
  return token;
}

async function confirmWithBiometrics() {
  const ok = (await LocalAuth.authenticateAsync({ promptMessage: "Confirm payment" })).success;
  return ok;
}
  • Declare each permission's purpose string (app.json → ios.infoPlist); stores reject vague reasons.
  • Request the minimum permission, at the moment it's needed.
  • Background location, notifications and files get extra store scrutiny.
Say it like a pro

"Permissions asked in context with a fallback path, push tokens stored server-side, and biometrics for sensitive actions."

dropped frames: jank 60 fps → 16 ms per frame · 120 Hz screens → 8 ms Common causes huge lists without virtualizationre-rendering everything on each changelarge images · heavy JS in onScroll Fixes FlatList / FlashListmemo, useCallback, stable keysresize + cache images Also watch startup time · app size (images, fonts, unused libs) · memory leaks · battery (polling, GPS)
PLATE 7 — Users feel dropped frames long before they can name them.
Chapter 7 · Performance

Smooth at 60 frames per second

import { memo, useCallback } from "react";
import { FlashList } from "@shopify/flash-list";
import { Image } from "expo-image";                         // caching, placeholders, fast decoding

const Row = memo(function Row({ item, onPress }: { item: Task; onPress: (id: string) => void }) {
  return <Pressable onPress={() => onPress(item.id)}><Text>{item.title}</Text></Pressable>;
});

export function Tasks({ tasks }: { tasks: Task[] }) {
  const open = useCallback((id: string) => router.push(`/tasks/${id}`), []);
  return <FlashList data={tasks} estimatedItemSize={56} keyExtractor={t => t.id}
                    renderItem={({ item }) => <Row item={item} onPress={open} />} />;
}
$ npx expo start --no-dev --minify          # test a production-like bundle; dev mode is much slower
$ npx expo-doctor                           # dependency and config health check
# profile: React DevTools Profiler · Flipper/Hermes profiler · Xcode Instruments · Android Studio Profiler
Hermes
React Native's JS engine: faster startup and lower memory
Reanimated
run animations on the UI thread so they stay smooth even if JS is busy
measure on a real, older phone
simulators on a fast laptop hide problems
Say it like a pro

"Virtualized lists, memoized rows, cached resized images, and profiled on a mid-range device in release mode."

E2E on devices component tests unit tests (logic) After release crash reporting (Sentry/Crashlytics) · analytics · staged rollout 1% → 10% → 100%
PLATE 8 — Real devices are messy. Test the logic cheaply and the flows end to end.
Chapter 8 · Testing & quality

Catch it before the store review does

$ npx expo install jest-expo jest @testing-library/react-native
$ npx jest --watch
import { render, screen, fireEvent } from "@testing-library/react-native";
import App from "../App";

test("increments the counter when tapped", () => {
  render(<App />);
  fireEvent.press(screen.getByRole("button", { name: /tap me/i }));
  expect(screen.getByText("Taps: 1")).toBeTruthy();
});
# .maestro/login.yaml : end-to-end flow on a real device or emulator (Maestro)
appId: com.acme.app
---
- launchApp
- tapOn: "Email"
- inputText: "test@example.com"
- tapOn: "Sign in"
- assertVisible: "Welcome"
$ maestro test .maestro/login.yaml
  • Test on a range of devices: small and large screens, old OS versions, slow network (Network Link Conditioner).
  • Turn on crash reporting before launch, and check source maps are uploaded.
  • Use feature flags and staged rollouts to limit the blast radius.
Say it like a pro

"Logic unit-tested, screens component-tested, key flows run by Maestro in CI, and releases staged with crash monitoring."

EAS build sign beta test review release Store checklist Apple Developer ($99/yr) · Google Play Console ($25 once) · unique bundle ID icons, splash, screenshots, description, privacy policy URL, data-safety / privacy labels test with TestFlight and Play internal / closed testing before production Updates native changes → new store build + review (hours to days) JS-only fixes → OTA update (EAS Update) within store rules Common rejection reasons crashes · broken login for reviewers · missing privacy details · placeholder content
PLATE 9 — Shipping to phones goes through gatekeepers. Prepare for them early.
Chapter 9 · Build & publish

From your laptop to the stores

$ npm i -g eas-cli && eas login
$ eas build:configure
$ eas build --platform all --profile production      # cloud builds, no Mac needed for iOS builds
$ eas submit --platform ios                       # → App Store Connect / TestFlight
$ eas submit --platform android                   # → Play Console
$ eas update --branch production --message "Fix login typo"   # OTA JS update
// eas.json
{ "build": {
    "development": { "developmentClient": true, "distribution": "internal" },
    "preview":     { "distribution": "internal" },
    "production":  { "autoIncrement": true }
  },
  "submit": { "production": {} } }

// app.json essentials
{ "expo": { "name": "My App", "slug": "my-app", "version": "1.0.0", "scheme": "myapp",
    "ios": { "bundleIdentifier": "com.acme.myapp", "buildNumber": "1" },
    "android": { "package": "com.acme.myapp", "versionCode": 1 } } }
versions
version (1.2.0, user-facing) vs build number / versionCode (must increase every upload)
signing
keep keystores and certificates backed up; losing the Android upload key is painful
next steps
learn Swift/SwiftUI and Kotlin/Jetpack Compose for native; Flutter as an alternative; App Store Optimization
Say it like a pro

"EAS builds in CI, beta through TestFlight and Play testing, staged rollout, and OTA updates for JS-only fixes."