Skip to content

Mobile apps · Expo

Habit tracker

Check off daily habits, see streaks and a seven-day history. Saved on the device with AsyncStorage.
Habit tracker starter, as built from its own files
Starter screenshot captured from this template's own web build (react-native-web) in a 390×844 phone viewport. In Codexa you can also open it on your phone with Expo Go.

What you get

A single-screen habit tracker: today's progress, a week strip to look back at any of the last seven days, habit rows with streaks and a mini history, and a form to add habits with an icon. Data persists with AsyncStorage (device storage on phones, localStorage on the web).

Files, exactly as copied.

Exactly what is copied into a new project: 14 files, nothing generated.

Raw data: GET /api/v1/templates/expo-habits

App.tsx
App.tsx
import { useState } from "react";import { ScrollView, StyleSheet, Text, View } from "react-native";import { StatusBar } from "expo-status-bar";import { SafeAreaProvider, useSafeAreaInsets } from "react-native-safe-area-context";import { HabitRow } from "./src/components/HabitRow";import { NewHabit } from "./src/components/NewHabit";import { WeekStrip } from "./src/components/WeekStrip";import { dayKey, sampleHabits, type Habit, type HabitIcon } from "./src/habits";import { useStoredState } from "./src/useStoredState";import { colors, radius, space } from "./src/theme"; export default function App() {  return (    <SafeAreaProvider>      <HabitsScreen />      <StatusBar style="dark" />    </SafeAreaProvider>  );} function HabitsScreen() {  const insets = useSafeAreaInsets();  const [habits, setHabits] = useStoredState<Habit[]>("habits-v1", sampleHabits);  const [selected, setSelected] = useState(() => new Date());  const key = dayKey(selected);  const doneCount = habits.filter((h) => h.done.includes(key)).length;  const pct = habits.length ? Math.round((doneCount / habits.length) * 100) : 0;  const isToday = key === dayKey(new Date());   const toggle = (id: string) =>    setHabits((list) => list.map((h) => (h.id !== id ? h : { ...h, done: h.done.includes(key) ? h.done.filter((d) => d !== key) : [...h.done, key] })));  const remove = (id: string) => setHabits((list) => list.filter((h) => h.id !== id));  const add = (name: string, icon: HabitIcon) => setHabits((list) => [...list, { id: `h${Date.now()}`, name, icon, goal: "Every day", done: [] }]);   return (    <ScrollView style={styles.scroll} contentContainerStyle={[styles.content, { paddingTop: insets.top + space.lg, paddingBottom: insets.bottom + space.xxl }]}>      <View>        <Text style={styles.date}>{selected.toLocaleDateString("en-US", { weekday: "long", month: "long", day: "numeric" })}</Text>        <Text style={styles.title} accessibilityRole="header">          {isToday ? "Today" : "Looking back"}        </Text>      </View>       <View style={styles.progress} accessibilityLabel={`${doneCount} of ${habits.length} habits done`}>        <View style={styles.progressText}>          <Text style={styles.progressBig}>{pct}%</Text>          <Text style={styles.progressSmall}>            {doneCount} of {habits.length} habits done          </Text>        </View>        <View style={styles.track}>          <View style={[styles.fill, { width: `${pct}%` }]} />        </View>      </View>       <WeekStrip selected={selected} onSelect={setSelected} habits={habits} />       <View style={styles.list}>        {habits.map((h) => (          <HabitRow key={h.id} habit={h} day={key} onToggle={() => toggle(h.id)} onRemove={() => remove(h.id)} />        ))}        {habits.length === 0 ? <Text style={styles.empty}>No habits yet. Add the first one below.</Text> : null}      </View>       <NewHabit onAdd={add} />    </ScrollView>  );} const styles = StyleSheet.create({  scroll: { flex: 1, backgroundColor: colors.background },  content: { paddingHorizontal: space.lg, gap: space.xl },  date: { fontSize: 14, color: colors.muted, fontWeight: "500" },  title: { fontSize: 32, fontWeight: "700", color: colors.text, letterSpacing: -0.6 },  progress: { backgroundColor: colors.accent, borderRadius: radius.lg, padding: space.xl, gap: space.md },  progressText: { flexDirection: "row", alignItems: "baseline", justifyContent: "space-between" },  progressBig: { fontSize: 40, fontWeight: "700", color: colors.accentText, letterSpacing: -1 },  progressSmall: { fontSize: 14, color: "#c9e7d8", fontWeight: "500" },  track: { height: 8, borderRadius: radius.pill, backgroundColor: "rgba(255,255,255,0.22)", overflow: "hidden" },  fill: { height: 8, borderRadius: radius.pill, backgroundColor: "#ffffff" },  list: { gap: space.sm },  empty: { textAlign: "center", color: colors.muted, paddingVertical: space.xl },});

Remix

Remix this template.

Describe what to change and the agent starts from Habit tracker's files. The box is already started for you: finish “Start from Habit tracker and …”

Agent ready

Creates a free account first; your idea is carried over.

Dependencies

Documented from the template's package.json. The runtime has a prebuilt dependency set for Expo · React Native, so installs are fast.

  • expo~58.0.23
  • react19.3.0
  • react-native0.88.1
  • react-native-web~0.21.4
  • react-native-safe-area-context~5.11.1
  • @expo/vector-icons^15.0.2
  • @react-native-async-storage/async-storage2.2.0
  • typescript~6.0.3

How it runs

Framework
Expo · React Native
Dev command
npm run dev
Build command
npm run build
Output directory
dist
Port
8081
Entry route
/

Projects run in an isolated sandbox with a live preview. Read the projects documentation for settings, snapshots and deployment.

All templates

Build on Habit tracker

Create a free account, start from this template, and ask the AI agent to turn it into your app.