0% found this document useful (0 votes)
19 views

React Native Cheat Sheet Galaxies

This cheat sheet provides essential commands and tools for developing React Native applications using Expo, including project initialization, server startup, and native code generation. It covers API routes, dynamic routing, and Expo Router hooks for handling navigation and URL parameters. Additionally, it offers troubleshooting commands and best practices for building apps for iOS and Android platforms.

Uploaded by

maybenrjeb
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

React Native Cheat Sheet Galaxies

This cheat sheet provides essential commands and tools for developing React Native applications using Expo, including project initialization, server startup, and native code generation. It covers API routes, dynamic routing, and Expo Router hooks for handling navigation and URL parameters. Additionally, it offers troubleshooting commands and best practices for building apps for iOS and Android platforms.

Uploaded by

maybenrjeb
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

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

You might also like