Expo React Native project
Expo React Native project
Create a file directory. For this example, name it my-app. Go inside that directory then type the
code below and press enter.
npx create-expo-app@latest ./
Once the installation is complete. Run the project by typing the code below.
Note: If an error occurred after running the project such as this. EMFILE: Too many file
watches. Just delete npm modules directory and reinstall it again by typing npx
install.
Inside the created project directory, there is a file named app.json. This file contains all the expo
configuration that will be used in this project.
Also in this project, there is a directory called app1. This directory contains the router
functionality.
Now to start working fresh2 on the created project. Type the code below. After running the
code, look for the app-example directory and delete it.
References:
1
https://docs.expo.dev/get-started/start-developing/#file-structure
2
https://docs.expo.dev/get-started/next-steps/#reset-your-project
Setting up NativeWind in Expo project
It is a good practice to check NativeWind website on how to install it to your Expo project 1. By
the time of this documentation. Below is step by step process to set up nativewind in your Expo
project.
tailwind.config.js
global.css
@tailwind base;
@tailwind components;
@tailwind utilities;
app/_layout.js
5. TypeScript (optional)
Create a new nativewind-env.d.ts file and add a triple-slashed directive referencing the
types.
References:
1
https://www.nativewind.dev/getting-started/expo-router
https://www.nativewind.dev/getting-started/typescript
One of the best features in using Expo in React Native is Expo Router. It is a file-based router
where it allows our React Native application to be organize by making each page or route match
a specific file in your project, which making it easier to create and manage pages.
References:
1
https://docs.expo.dev/router/introduction/
2
https://docs.expo.dev/develop/file-based-routing/