DEV Community

Cover image for Building Production React Native Apps: From Scaffold to App Store
Mango Developer
Mango Developer

Posted on Originally published at mangodeveloper.com

Building Production React Native Apps: From Scaffold to App Store

The first React Native app I shipped, in 2018, was a disaster. Build times of 12 minutes, crashes on Android 8, a navigation library that was deprecated halfway through development, and a final APK that exceeded the Play Store size limit by 8MB. The second one, last year, took six weeks from idea to App Store and worked on the first review submission. The difference wasn't my skill-it was that React Native finally grew up.

In 2024, React Native is a legitimate choice for serious apps. Instagram, Discord, Shopify, Microsoft Office, Tesla-all run on React Native in production. The New Architecture (Fabric renderer + Hermes engine + TurboModules) closed most of the performance gap with native. Expo Application Services (EAS) made builds and OTA updates something you do from a web dashboard. The ecosystem stabilized.

This article is the path I take when I start a new RN app today. We'll cover the Expo vs RN CLI decision, the New Architecture, navigation, state, persistence, networking, push, OTA updates, testing, deployment, and every production gotcha I've stepped on. By the end you'll have a working app and a clear sense of the trade-offs.

Expo vs React Native CLI: Pick One

This is the first decision and it shapes everything else. Quick comparison:

Aspect Expo (with EAS) React Native CLI (bare)
Initial setup npx create-expo-app npx react-native init
Native modules Auto-configured via config plugins Manual Xcode/Android Studio work
Build pipeline EAS Build (cloud) or local Local Xcode + Gradle
OTA updates Built in (EAS Update) DIY (CodePush, custom)
Eject to bare Possible, but messy N/A-you're already bare
Native code access Prebuild + config plugins Direct
Build times Cloud (10-30 min) or local Local (5-15 min incremental)
Best for Most apps, especially first RN app Apps with heavy native code, custom renderers, or specific platform needs

My default: Expo for everything unless you have a specific reason not to. The days of "Expo is too restrictive" ended with Expo SDK 50+. With Prebuild and config plugins, you can drop down to native code when you need to. EAS Build handles the painful parts-signing certificates, provisioning profiles, Android keystore management. The cost (cloud build minutes, or local build complexity) is worth it for 95% of projects.

When to go bare RN CLI: you're building something with custom native rendering (a video editor with custom OpenGL, an AR app), you need bleeding-edge platform APIs not yet wrapped by Expo, or your team has deep native expertise and wants full control. Everyone else: Expo.

The New Architecture: Hermes, Fabric, TurboModules

Since React Native 0.76 (October 2024), the New Architecture is the default. Understanding it matters because it affects how you write code.

Hermes is the JavaScript engine, replacing JavaScriptCore on iOS and the old JSC on Android. Hermes precompiles JS to bytecode, which means faster startup (no JIT warmup), lower memory, and smaller bundle sizes. It's the single biggest perf win in modern RN. It's enabled by default; don't disable it.

Fabric is the new renderer. The old architecture (the "paper" renderer) walked the JS bridge to commit UI changes, which serialized everything and caused jank. Fabric renders synchronously on the UI thread with a C++ "shadow tree," bypassing the bridge for layout. The visible effect: less jank on lists, faster animations, better scroll performance.

TurboModules replace the old NativeModules bridge. They use JSI (JavaScript Interface) for direct JS-to-native calls without serialization. A native method call that took 5ms on the bridge can take sub-millisecond with JSI. This matters for things like camera, sensors, and any high-frequency native call.

Bridgeless mode is the final piece-the JS bridge is gone entirely, replaced with direct JSI calls. Default in 0.76+.

What this means in practice:

  • Most existing libraries need New Architecture support. Check before adding. The popular ones (Reanimated, Gesture Handler, Navigation, MMKV) all support it as of 2024.
  • You might need to add "newArchEnabled": true in app.json for older Expo SDKs, but SDK 51+ enables it by default.
  • If you maintain a native module, you need to migrate to TurboModules. The community has tooling for this.

Prerequisites and Environment Setup

You need:

  • Node 20 LTS (not 22 yet-some deps lag).
  • Watchman (brew install watchman on macOS).
  • Xcode 15+ on macOS for iOS builds.
  • Android Studio for Android builds.
  • An Apple Developer account ($99/year) for App Store.
  • A Google Play Developer account ($25 one-time) for Play Store.
  • For EAS: an Expo account (free tier covers small projects).

On macOS, install dependencies:

BashCopy

Enter fullscreen mode Exit fullscreen mode

brew install node watchman
brew install --cask cocoapods

Android Studio from developer.android.com or:

brew install --cask android-studio

Enter fullscreen mode Exit fullscreen mode

Accept Android SDK licenses:

BashCopy

Enter fullscreen mode Exit fullscreen mode


shell
yes | /usr/local/share/android-commandlinetools/cmdline-tools/latest/bin/sdkmanager --licenses

Enter fullscreen mode Exit fullscreen mode


plaintext

Create the project:

BashCopy

Enter fullscreen mode Exit fullscreen mode


shell
npx create-expo-app@latest mango-tasks --template default
cd mango-tasks
npx expo install expo-router expo-secure-store expo-sqlite expo-notifications @react-native-async-storage/async-storage react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context

Enter fullscreen mode Exit fullscreen mode


plaintext

Folder structure:

CodeCopy

Enter fullscreen mode Exit fullscreen mode


plaintext
mango-tasks/
├── app/ # Expo Router pages (file-based routing)
│ ├── _layout.tsx
│ ├── index.tsx # Home / task list
│ ├── task/[id].tsx # Task detail
│ └── settings.tsx
├── components/
├── lib/
│ ├── db.ts # SQLite setup
│ ├── api.ts # API client
│ ├── auth.ts # Auth + token storage
│ └── notifications.ts # Push setup
├── assets/
├── app.json # Expo config
├── eas.json # EAS build profiles
├── package.json
└── tsconfig.json

Enter fullscreen mode Exit fullscreen mode


markdown

I prefer TypeScript for any RN project of meaningful size. The compiler catches a class of bugs that are otherwise only found by runtime crashes on devices you don't own.

Configuration: app.json and eas.json

app.json (Expo config, simplified):

JSONCopy

Enter fullscreen mode Exit fullscreen mode


json
{
"expo": {
"name": "Mango Tasks",
"slug": "mango-tasks",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"scheme": "mangotasks",
"userInterfaceStyle": "automatic",
"newArchEnabled": true,
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.mango.tasks",
"infoPlist": {
"NSCameraUsageDescription": "Used to attach photos to tasks."
}
},
"android": {
"package": "com.mango.tasks",
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#0b0f17"
},
"permissions": ["android.permission.CAMERA"]
},
"plugins": [
"expo-router",
"expo-secure-store",
["expo-notifications", { "icon": "./assets/notif-icon.png", "color": "#f59e0b" }]
],
"extra": {
"eas": { "projectId": "your-project-id" }
}
}
}

Enter fullscreen mode Exit fullscreen mode


json

eas.json:

JSONCopy

Enter fullscreen mode Exit fullscreen mode


json
{
"cli": { "version": ">= 5.9.0" },
"build": {
"development": {
"developmentClient": true,
"distribution": "internal",
"env": { "API_URL": "https://api.staging.mango.example" }
},
"preview": {
"distribution": "internal",
"env": { "API_URL": "https://api.staging.mango.example" }
},
"production": {
"autoIncrement": true,
"env": { "API_URL": "https://api.mango.example" }
}
},
"submit": {
"production": { "ios": { "appleId": "you@example.com", "ascAppId": "1234567890" } }
}
}

Enter fullscreen mode Exit fullscreen mode


markdown

The env block injects environment variables at build time. Use them to switch API URLs between staging and production. Never commit secrets to app.json-use EAS environment variables or a secrets manager.

Navigation with Expo Router

Expo Router brings file-based routing to RN (similar to Next.js). Each file in app/ becomes a route. This is now the recommended navigation approach.

app/_layout.tsx (root layout):

TypeScriptCopy

Enter fullscreen mode Exit fullscreen mode


jsx
import { Stack } from 'expo-router';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { StatusBar } from 'expo-status-bar';
import { useEffect } from 'react';
import * as Notifications from 'expo-notifications';
import { initNotifications } from '../lib/notifications';

export default function RootLayout() {
useEffect(() => {
initNotifications();
}, []);

return (



headerTintColor: '#f59e0b',
contentStyle: { backgroundColor: '#0b0f17' } }}>






);
}

Enter fullscreen mode Exit fullscreen mode


tsx

app/index.tsx:

TypeScriptCopy

Enter fullscreen mode Exit fullscreen mode


jsx
import { FlatList, Pressable, StyleSheet, Text, View } from 'react-native';
import { useFocusEffect, useRouter } from 'expo-router';
import { useCallback, useState } from 'react';
import { loadTasks, Task } from '../lib/db';

export default function TaskList() {
const router = useRouter();
const [tasks, setTasks] = useState([]);

useFocusEffect(useCallback(() => {
loadTasks().then(setTasks);
}, []));

return (

data={tasks}
keyExtractor={(t) => t.id}
renderItem={({ item }) => (
router.push(/task/${item.id})}>
{item.title}
{item.due_at ?? 'No due date'}

)}
ItemSeparatorComponent={() => }
/>

);
}

const styles = StyleSheet.create({
container: { flex: 1, padding: 16 },
row: { paddingVertical: 14 },
title: { color: '#fff', fontSize: 16, fontWeight: '500' },
meta: { color: '#9ca3af', fontSize: 13, marginTop: 4 },
});

Enter fullscreen mode Exit fullscreen mode


markdown

Important notes:

  • useFocusEffect runs when the screen gains focus. Use it for refreshing data when the user navigates back to a screen. Don't use useEffect-it only runs once on mount, and the component stays mounted when you navigate away.
  • FlatList is virtualized. Don't use ScrollView for long lists-it renders every item and tanks performance.
  • react-native-gesture-handler and react-native-screens are required for proper native navigation. Wrap the root in GestureHandlerRootView.
  • SafeAreaProvider is required for notches. Use useSafeAreaInsets in screens to handle the safe area.

State, Persistence, and Networking

For most apps, the right state stack is:

  • Local UI state: useState, useReducer.
  • Server cache: TanStack Query (React Query). Don't reinvent data fetching.
  • Persistent state: expo-sqlite for structured data, MMKV for KV.
  • Global app state: Zustand. Avoid Redux unless you have a real reason.

lib/api.ts:

TypeScriptCopy

Enter fullscreen mode Exit fullscreen mode


typescript
import * as SecureStore from 'expo-secure-store';
import { Platform } from 'react-native';

const API_URL = process.env.EXPO_PUBLIC_API_URL || 'http://localhost:3000';

export class ApiError extends Error {
constructor(public status: number, message: string) { super(message); }
}

async function authedFetch(path: string, init: RequestInit = {}) {
const token = await SecureStore.getItemAsync('access_token');
const res = await fetch(${API_URL}${path}, {
...init,
headers: {
'Content-Type': 'application/json',
...(token ? { Authorization: Bearer ${token} } : {}),
...init.headers,
},
});
if (!res.ok) {
const body = await res.json().catch(() => ({}));
throw new ApiError(res.status, body.message || res.statusText);
}
if (res.status === 204) return null;
return res.json();
}

export const api = {
getTasks: () => authedFetch('/api/tasks'),
createTask: (data: { title: string; due_at?: string }) =>
authedFetch('/api/tasks', { method: 'POST', body: JSON.stringify(data) }),
login: (email: string, password: string) =>
authedFetch('/api/auth/login', { method: 'POST', body: JSON.stringify({ email, password }) }),
};

Enter fullscreen mode Exit fullscreen mode


typescript

lib/db.ts (SQLite for offline-first):

TypeScriptCopy

Enter fullscreen mode Exit fullscreen mode


typescript
import * as SQLite from 'expo-sqlite';
import { Asset } from 'expo-asset';

export interface Task {
id: string;
title: string;
due_at: string | null;
completed: boolean;
}

let db: SQLite.SQLiteDatabase | null = null;

export async function getDb() {
if (db) return db;
db = await SQLite.openDatabaseAsync('mango.db');
await db.execAsync(
PRAGMA journal_mode = WAL;
CREATE TABLE IF NOT EXISTS tasks (
id TEXT PRIMARY KEY NOT NULL,
title TEXT NOT NULL,
due_at TEXT,
completed INTEGER NOT NULL DEFAULT 0,
updated_at INTEGER NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_tasks_due ON tasks(due_at);
);
return db;
}

export async function loadTasks(): Promise {
const db = await getDb();
const rows = await db.getAllAsync(
SELECT id, title, due_at, completed FROM tasks
ORDER BY completed ASC, COALESCE(due_at, '9999') ASC
);
return rows.map(r => ({ ...r, completed: !!r.completed }));
}

export async function upsertTask(task: Task) {
const db = await getDb();
await db.runAsync(
INSERT OR REPLACE INTO tasks (id, title, due_at, completed, updated_at)
VALUES (?, ?, ?, ?, ?)
,
[task.id, task.title, task.due_at, task.completed ? 1 : 0, Date.now()]
);
}

Enter fullscreen mode Exit fullscreen mode


plaintext

WAL mode (PRAGMA journal_mode = WAL) is critical for write performance on SQLite. Without it, every write locks the DB. With it, reads and writes can run concurrently.

Use TanStack Query to glue server and local cache:

TypeScriptCopy

Enter fullscreen mode Exit fullscreen mode


javascript
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';

export function useTasks() {
return useQuery({
queryKey: ['tasks'],
queryFn: async () => {
const remote = await api.getTasks();
// Sync to local SQLite
await Promise.all(remote.map(upsertTask));
return remote;
},
// Show local cache first, then update with remote
initialData: async () => loadTasks(),
});
}

export function useCreateTask() {
const qc = useQueryClient();
return useMutation({
mutationFn: api.createTask,
onSuccess: () => qc.invalidateQueries({ queryKey: ['tasks'] }),
});
}

Enter fullscreen mode Exit fullscreen mode


markdown

Push Notifications

Push on RN goes through Expo's notifications module, which abstracts APNs (iOS) and FCM (Android).

lib/notifications.ts:

TypeScriptCopy

Enter fullscreen mode Exit fullscreen mode


javascript
import * as Notifications from 'expo-notifications';
import { Platform } from 'react-native';
import { api } from './api';

Notifications.setNotificationHandler({
handleNotificationReceived: () =>
Promise.resolve({ shouldShowAlert: true, shouldPlaySound: true, shouldSetBadge: false }),
});

export async function initNotifications() {
const { status: existing } = await Notifications.getPermissionsAsync();
let final = existing;
if (existing !== 'granted') {
const { status } = await Notifications.requestPermissionsAsync();
final = status;
}
if (final !== 'granted') return;

const token = (await Notifications.getExpoPushTokenAsync({
projectId: 'your-eas-project-id',
})).data;

await api.registerPushToken(token);

if (Platform.OS === 'android') {
await Notifications.setNotificationChannelAsync('default', {
name: 'default', importance: Notifications.AndroidImportance.MAX,
});
}
}

Enter fullscreen mode Exit fullscreen mode


plaintext

Note that on iOS, push requires a paid Apple Developer account and a real device. The simulator doesn't support push. On Android, the emulator supports FCM if you've set up Google Play services.

Use Expo's push service for free token delivery, or set up your own with the expo-server-sdk for direct FCM/APNs. The free service handles fanout and retries; the paid path gives you more control and avoids a third party in your notification path.

For local notifications (scheduled reminders without a server), use Notifications.scheduleNotificationAsync:

TypeScriptCopy

Enter fullscreen mode Exit fullscreen mode


typescript
await Notifications.scheduleNotificationAsync({
content: { title: 'Task due', body: task.title },
trigger: { date: new Date(task.due_at!) },
});

Enter fullscreen mode Exit fullscreen mode


markdown

OTA Updates with EAS Update

One of the killer features of RN: ship JavaScript changes without app store review. EAS Update handles this.

Setup:

BashCopy

Enter fullscreen mode Exit fullscreen mode


plaintext
eas update:configure

Enter fullscreen mode Exit fullscreen mode


plaintext

This adds the expo-updates config to your project. Then, to push an update:

BashCopy

Enter fullscreen mode Exit fullscreen mode


shell
eas update --branch production --message "Fix crash on task creation"

Enter fullscreen mode Exit fullscreen mode


markdown

The update is published to EAS's servers. The next time users open the app (within the rollout policy you configure), they get the new JS bundle. No review, no waiting.

Critical policy decisions:

  • Rollout strategy. Default is "everyone gets the latest immediately." For production apps, configure a phased rollout (e.g., 10% → 50% → 100% over a few days) and a rollback button.
  • Channel/branch strategy. Use production for App Store builds, staging for TestFlight/internal. Don't cross-contaminate.
  • Native updates. OTA can't update native code. If you change anything in app.json plugins, native modules, or add a new permission, you need a full app store release. Plan accordingly.
  • Version checks. The update policy can be "check on launch" (default), "check on resume," or "check periodically." Pick based on how critical real-time updates are.

For apps with serious user bases, run your own updates server. The expo-updates library supports custom update URLs, so you can host the bundles on your own CDN and control rollout fully.

Building and Submitting

Build for production:

BashCopy

Enter fullscreen mode Exit fullscreen mode


shell

iOS production build (EAS Build cloud, ~25 minutes)

eas build --platform ios --profile production

Android production build (EAS Build cloud, ~15 minutes)

eas build --platform android --profile production

Enter fullscreen mode Exit fullscreen mode


plaintext

Or build locally (faster if you've got the toolchain set up):

BashCopy

Enter fullscreen mode Exit fullscreen mode


shell
eas build --platform ios --profile production --local

Enter fullscreen mode Exit fullscreen mode


plaintext

Local builds avoid burning EAS Build credits and are faster for iterative development. Cloud builds are useful when you don't have a Mac (for Android) or want consistent build environments.

Submit to stores:

BashCopy

Enter fullscreen mode Exit fullscreen mode


shell

Submit to App Store

eas submit --platform ios --latest

Submit to Play Store

eas submit --platform android --latest

Enter fullscreen mode Exit fullscreen mode


markdown

The submit command uses your stored credentials to upload the build. For iOS, this requires your Apple ID and an app-specific password (or App Store Connect API key, which is more reliable for CI).

Apple will still review your app. Typical review times: 24-48 hours for a new app, 6-24 hours for updates. Common rejection reasons I've hit:

  • Missing privacy policy URL. Required for any app that collects data (which is any app).
  • Missing App Tracking Transparency prompt. If you use IDFA (advertising identifier), you must show the ATT prompt before accessing it.
  • Crash on launch. Test on a real device, not just simulator. Common cause: missing native dependency not linked.
  • Login credentials required for review. If your app requires login, provide a demo account in App Store Connect. Reviewers won't sign up.
  • Misleading metadata. Screenshots must match the actual app. Don't promise features that aren't there.
  • Minimum functionality. If your app is just a wrapper around a website with no added value, Apple rejects it. Have native-feeling UX.

Production Considerations

Bundle size. Apps over 150MB can't be downloaded over cellular on iOS. Use App Thinning (asset catalogs, on-demand resources) for large assets. On Android, use APK splits or App Bundle (.aab) to ship per-architecture binaries.

Startup time. Hermes helps a lot. Measure cold-start time on a low-end Android device (Moto G or similar)-iOS is forgiving, Android isn't. Move heavy imports to lazy require: const Heavy = lazy(() => import('./Heavy')). Avoid importing large libraries at top-level if only one screen uses them.

Memory. RN apps leak memory easily-timer not cleared, listener not removed, large image cached. Use useEffect cleanup religiously. For images, use expo-image which has built-in caching and downsampling, not the bare Image component.

Animations. Use react-native-reanimated (worklets on the UI thread, not JS thread). The default Animated API runs on the JS thread and janks on slow devices. Reanimated 3+ with the New Architecture is fast.

Lists. FlatList and SectionList are virtualized but only as good as your renderItem. Keep it cheap. For complex items, use FlashList from Shopify, which recycles views and is dramatically faster for complex items.

Offline. If your app needs to work offline, design for it from day one. Local SQLite + a sync queue + TanStack Query for cache state. Don't bolt offline on after the fact.

Crash reporting. Sentry has the best RN integration. Set release tags so you can attribute crashes to specific versions. Source maps uploaded to Sentry (or your tool of choice) are essential-without them, you see minified JS in stack traces.

Performance monitoring. Use Flipper (deprecated in 0.74+) or React DevTools for JS profiling. For native profiling, Xcode Instruments and Android Studio Profiler. The Hermes profiler gives you JS flame graphs.

Common Mistakes and How to Detect Them

Using Animated instead of Reanimated. Animated runs on the JS thread and janks. Detection: animations stutter on low-end Android. Fix: migrate to Reanimated 3+.

Forgetting keyExtractor on FlatList. Default uses index, which breaks when items reorder. Detection: weird re-renders, items flicker. Fix: always provide a stable keyExtractor.

Not handling the safe area. Content gets cut off by notches. Detection: iPhone 14 Pro shows content under the Dynamic Island. Fix: wrap screens in SafeAreaView or use useSafeAreaInsets.

Storing tokens in AsyncStorage. AsyncStorage is unencrypted on Android. Detection: open the app's data directory on a rooted device, see plaintext tokens. Fix: expo-secure-store (Keychain on iOS, encrypted SharedPreferences on Android).

Not cleaning up listeners. Notification listeners, network subscriptions, timers leak. Detection: memory grows over a session, crashes after long use. Fix: return cleanup functions from useEffect.

Building only on simulator. Simulator uses your Mac's CPU and ignores real device constraints. Detection: app works on simulator, crashes or is slow on real iPhone. Fix: test on real devices, especially low-end Android.

Missing react-native-gesture-handler import at root. Causes crashes on navigation gestures. Detection: app crashes when swiping back on iOS. Fix: import at the very top of your entry file, before anything else.

Treating useEffect like useFocusEffect. useEffect runs once on mount; if the screen stays mounted (it does, by default), data goes stale. Detection: list shows old data after navigating back. Fix: use useFocusEffect for refresh-on-focus.

Troubleshooting Real Production Issues

Symptom: Android build fails with "OutOfMemoryError: Java heap space."
Cause: Gradle needs more heap. Fix: in android/gradle.properties, set org.gradle.jvmargs=-Xmx4g. Also use --max-workers=2 to limit parallelism.

Symptom: iOS build fails with "Cycle inside your app; linking would fail."
Cause: CocoaPods version mismatch, or a pod needs a higher iOS deployment target. Fix: cd ios && pod install --repo-update. If persists, set IPHONEOS_DEPLOYMENT_TARGET to 14.0 or higher in Podfile.

Symptom: App crashes on launch on a specific Android device.
Cause: Usually a 64-bit-only native library on a 32-bit device, or an arm64-v8a-only build. Fix: build fat APK or use App Bundle so Google Play serves the right architecture.

Symptom: Push notifications work in development, never delivered in production.
Cause: iOS production push requires a production APNs certificate, not the development one. Fix: use EAS to manage credentials, or generate a production APNs key in Apple Developer portal.

Symptom: OTA update bricks the app for some users.
Cause: Update referenced a native module not in the binary (OTA can't add native code). Fix: roll back the OTA branch, ensure OTA updates only touch JS.

Symptom: Slow cold start (5+ seconds) on Android.
Cause: Heavy synchronous work at launch-large initial route, many top-level imports, splash screen hidden too early. Fix: code-split, lazy-import, defer non-critical init, use react-native-bootsplash to control splash timing.

Symptom: Reanimated animations jank on Android.
Cause: Not using the New Architecture, or worklet doing heavy work. Fix: enable New Architecture, ensure worklets stay simple, move computation to JS or native.

Testing

Unit tests with Jest:

TypeScriptCopy

Enter fullscreen mode Exit fullscreen mode


typescript
// tests/api.test.ts
import { api } from '../lib/api';
jest.mock('expo-secure-store');

test('createTask POSTs to /api/tasks', async () => {
const spy = jest.spyOn(global, 'fetch').mockResolvedValue(
new Response(JSON.stringify({ id: '1', title: 'test' }), { status: 200 })
);
await api.createTask({ title: 'test' });
expect(spy).toHaveBeenCalledWith(
expect.stringContaining('/api/tasks'),
expect.objectContaining({ method: 'POST' })
);
});

Enter fullscreen mode Exit fullscreen mode


markdown

Component tests with React Native Testing Library:

TypeScriptCopy

Enter fullscreen mode Exit fullscreen mode


jsx
import { render, fireEvent } from '@testing-library/react-native';
import TaskList from '../app/index';

test('renders tasks', () => {
const { getByText } = render();
expect(getByText('Buy milk')).toBeTruthy();
});

Enter fullscreen mode Exit fullscreen mode


markdown

End-to-end tests with Detox or Maestro. Maestro is the newer, simpler option:

YAMLCopy

Enter fullscreen mode Exit fullscreen mode


yaml

.maestro/task-flow.yaml

appId: com.mango.tasks

  • launchApp
  • assertVisible: "Tasks"
  • tapOn: "New Task"
  • inputText: "Write the article"
  • tapOn: "Save"
  • assertVisible: "Write the article"
Enter fullscreen mode Exit fullscreen mode


markdown

Run with maestro test .maestro/task-flow.yaml. Maestro runs on real devices and simulators, doesn't require testID instrumentation everywhere, and has the best DX of any RN testing tool I've used.

CI/CD with EAS:

BashCopy

Enter fullscreen mode Exit fullscreen mode


shell
eas build --platform all --profile preview --non-interactive
eas submit --platform ios --latest --non-interactive

Enter fullscreen mode Exit fullscreen mode

Run unit + component tests on every PR. Run Detox/Maestro on staging builds nightly. Run EAS Build on merges to main, submit to TestFlight / internal track for QA.

Cost and Alternatives

Approach Best for Cost Trade-off
React Native + Expo Most apps, cross-platform from one team Free + EAS ($0-59+/mo) Some platform-specific work needed
React Native bare Heavy native code, custom renderers Free + native dev time More setup, more maintenance
Flutter True cross-platform with consistent UI Free Dart (new language for most teams), larger app size
Native (Swift/Kotlin) Max performance, deep OS integration Native dev time per platform Two codebases, two teams
Capacitor / Ionic Web codebase wrapped for mobile Free + native dev time Performance ceiling, hybrid feel
.NET MAUI Enterprise with .NET stack Free + Visual Studio Smaller ecosystem

EAS pricing as of late 2024: free tier includes 15 builds/month, paid tier starts at $19/month for more builds and concurrent builds. For most teams, the free tier is enough for development; production teams usually want the $19-59 tier for concurrent builds and faster iteration.

Comparing RN to Flutter: both are excellent. RN wins if your team knows React/TypeScript and you want to share code with a web app. Flutter wins if you want pixel-perfect UI consistency across platforms or you're starting a team that doesn't have React experience. Performance is roughly comparable with RN's New Architecture.

Real-World Use Cases

  • Shopify. Migrated their entire mobile app from native to React Native. Public case studies cite faster shipping and shared code with their React web admin.
  • Discord. iOS app is React Native, Android is native (historically; this may have changed). Mix-and-match is possible.
  • Instagram and Facebook. Heavy RN usage for many surfaces, with native for performance-critical feeds.
  • Tesla. App uses RN for most surfaces.
  • Microsoft Office. Parts of the mobile Office suite use RN.
  • B2B internal apps. Excellent fit-small teams, frequent updates, OTA for fast iteration, one codebase.
  • E-commerce apps. Common. Good balance of native feel with web-like iteration speed.

Wrapping Up

React Native in 2024 is the rare cross-platform framework that doesn't feel like a compromise. The New Architecture closed the performance gap, Expo handles the painful parts of mobile development, and the ecosystem stabilized to the point where you can ship a real app in weeks, not months.

The things that still bite you: native dependencies lagging the New Architecture, iOS App Store review randomness, and the ever-present temptation to share too much code with web. Get those right and the rest is mostly execution.

If you take one thing from this: start with Expo, enable the New Architecture, and don't reinvent state management. That's the path that's worked for me on every successful RN project in the last two years.


Originally published on Mango Developer.

Top comments (0)