TLDR: Testing React Native App Locally with Expo
Quick Start (5 minutes)
1. Prerequisites
# Make sure you have Node.js and npm installed
node --version # Should be v18+
npm --version
# Install Expo CLI globally (if not already installed)
npm install -g expo-cli
2. Install Dependencies
# From project root
cd apps/mobile
npm install --legacy-peer-deps
Note: We use --legacy-peer-deps to handle React version conflicts between dependencies.
3. Set Up Environment Variables
Create apps/mobile/.env file:
# Backend API URL (your local backend)
EXPO_PUBLIC_API_URL=http://localhost:3001
# Supabase (get these from your Supabase dashboard)
EXPO_PUBLIC_SUPABASE_URL=your_supabase_url_here
EXPO_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key_here
Note: If you're using the same Supabase instance as the web app, check apps/frontend/.env.local for these values.
4. Start Backend (if not running)
# From project root
cd apps/backend
npm install
npm run dev # Should start on port 3001
5. Start Expo
# From apps/mobile directory
npx expo start
Or use the npm script:
npm start # This runs npx expo start
This will:
- Start the Expo dev server
- Show a QR code in terminal
- Open Expo DevTools in browser
6. Run on Device/Simulator
Option A: Physical Device
-
Install Expo Go app on your phone (iOS App Store or Google Play)
-
Scan the QR code from terminal with:
- iOS: Open Expo Go app → Tap "Scan QR Code" (NOT the Camera app)
- Android: Expo Go app
Troubleshooting QR Code Issues:
- If Camera app says "no usable data": Use Expo Go app directly to scan
- If still not working: Make sure phone and computer are on same WiFi
- Alternative: Use tunnel mode:
npx expo start --tunnel(slower but works across networks) - Manual entry: In Expo Go, tap "Enter URL manually" and enter:
exp://10.0.0.221:8081(replace with your IP)
Option B: iOS Simulator (Mac only)
npm run ios
# Or press 'i' in the Expo terminal
Option C: Android Emulator
npm run android
# Or press 'a' in the Expo terminal
# (Requires Android Studio + emulator set up)
Option D: Web Browser
npm run web
# Or press 'w' in the Expo terminal
Testing New Features
Sleep Tracking
- Go to Stream tab
- Tap the mood slider (bottom right)
- Tap "Log Sleep" button
- Enter hours slept and save
- Verify sleep entry appears in Stream
Energy Tracking
- Go to Dashboard tab
- Tap "+" to create new entry
- Scroll to "Energy" section
- Select energy level (0-10)
- Save entry
- Verify energy shows in entry card
Analysis
- Go to Settings tab
- Tap "Journal Analysis"
- Tap "Trigger Analysis" button
- Select granularity (day/week/month)
- Wait for analysis to complete
- Tap analysis card to view details
JQ Bridge
- Go to Settings tab
- Tap "JQ Bridge"
- Tap "Add New Connection"
- Enter email and set permissions
- View connections list
Chatbot
- Look for JQ button (bottom right, purple pulsing)
- Tap to open chatbot
- Type a message and send
- Wait for JQ response
Encouragement Drops
- Go to Stream tab
- Tap on any entry
- Look for "Send Drop" option (if available)
- Or go to Settings → Encouragement Drops
- View received drops
Common Issues & Fixes
"Network request failed"
- Fix: Make sure backend is running on
http://localhost:3001 - Fix: If using physical device, use your computer's IP address:
# Find your IP (Mac/Linux) ifconfig | grep "inet " | grep -v 127.0.0.1 # Then in .env: EXPO_PUBLIC_API_URL=http://YOUR_IP:3001
"Missing Supabase environment variables"
- Fix: Make sure
.envfile exists inapps/mobile/with both Supabase variables
"No usable data" when scanning QR code (iPhone)
- Fix: Don't use Camera app - open Expo Go app directly and tap "Scan QR Code"
- Fix: Make sure both devices are on same WiFi network
- Fix: Try tunnel mode:
npx expo start --tunnel(works across networks) - Fix: Manually enter URL in Expo Go:
exp://YOUR_IP:8081(get IP from terminal output)
"Cannot connect to Expo"
- Fix: Make sure phone and computer are on same WiFi network
- Fix: Try tunnel mode:
npx expo start --tunnel(slower but more reliable)
"Module not found" errors
- Fix: Run
npm install --legacy-peer-depsagain inapps/mobile/ - Fix: Clear cache:
npx expo start -c
Date picker not working
- Fix: Install missing package:
cd apps/mobile npm install @react-native-community/datetimepicker --legacy-peer-deps
"Invalid hook call" or React version conflicts
- Fix: This is usually caused by multiple React versions. We use
--legacy-peer-depsto resolve this:cd apps/mobile rm -rf node_modules package-lock.json npm install --legacy-peer-deps
Quick Commands Reference
# Start Expo
npx expo start
# Or use npm script: npm start
# Start with tunnel (for testing on different networks)
npx expo start --tunnel
# Clear cache and restart
npx expo start -c
# Run on specific platform
npm run ios
npm run android
npm run web
# Install new package (always use --legacy-peer-deps)
cd apps/mobile
npm install package-name --legacy-peer-deps
# Check logs
# Press 'j' in Expo terminal to open debugger
Testing Checklist
- App opens without errors
- Can sign in/sign up
- Can create journal entry
- Can add mood and energy to entry
- Can log sleep entry
- Sleep entries appear in Stream
- Can trigger analysis
- Can view analysis details
- Can create JQ Bridge connection
- Can open chatbot
- Can send/receive drops
- All navigation works
Pro Tips
- Hot Reload: Changes auto-reload (shake device to open dev menu)
- Debugging: Press
jin Expo terminal to open React Native Debugger - Logs: Check Expo terminal for console logs
- Reload: Shake device → "Reload" or press
rin terminal - Performance: Use
npx expo start --no-devfor production-like performance - Always use
--legacy-peer-deps: When installing packages, always add--legacy-peer-depsflag to avoid React version conflicts
Need Help?
- Check Expo docs: https://docs.expo.dev/
- Check React Native docs: https://reactnative.dev/
- Check project README:
apps/mobile/README.md(if exists)