React Native + Expo Cheat Sheet Galaxies.
dev
npx create-expo-app [name] npx expo export API Routes
This tool simplifies the initialization process by providing various templates Export the JavaScript assets of your app using Metro. API Routes are defined by creating files in the app directory with
to get started quickly without the need for manual configuration the +api.ts extension. Safe to use API keys and sensitive data.
The directory to export the static files to
default, blank, blank-typescript, tabs, bare-minimum
Skip minifying JavaScript and CSS assets
use one of the expo examples
npx expo-doctor
npx expo start Diagnose issues with the project
Not found routes
Start a server for developing your app. Short form “expo start” also works. Directly ix incompatible dependency version Handle 404 errors in your app with a +not-found.tsx page.
This route matches all unmatched routes from a nested level.
Always launch the app in a development build
Always launch the app in Expo Go npx create-expo-module Dynamic routes
Port to start the dev server on (default: 8081) Generate a native Expo Module in your project for writing Dynamic routes match any unmatched path at a given segment level.
native Swift or Kotlin code Multiple slugs can be matched in a single route by using the rest syntax.
npx expo prebuild DOM Components
Generate the native code for your project. Work with modern web code directly in your Expo app by using
the ‘use dom’ directive and import the web component to use it.
Delete any existing native directories before generating
Build only for individual platform ios or android
Expo Router Hooks
npx expo run:ios Given a function, the useFocusEffect hook will invoke the function
whenever the route is "focused".
Compile your app locally and run on iOS.
Can only be run on a Mac, and Xcode must be installed.
Rewrite incoming native deep links
Build directly on connected devices
Create a special +native-intent.tsx file at the top level of your project’s
Clear the native cache before building app directory to rewrite URLs to correctly target a route.
Use “Release” to make a production build
useLocalSearchParams returns the URL parameters for the
contextually selected route.
npx expo run:android
Compile your app locally and run on Android. Return the current route name with usePathname or get all URL
segments with useSegments.
Select a variant from your build.gradle