๐๐ป ๋ฆฌ์กํธ๋ค์ดํฐ๋ธ Expo๋ ์๋ฐ์คํฌ๋ฆฝํธ๋ก ๋ชจ๋ฐ์ผ ์ฑ์ ๋ง๋ค ์ ์๋ ๋๊ตฌ์
๋๋ค.
React Native Expo is a tool that allows you to build mobile apps with JavaScript.
๐๐ป nodejsํ๊ฒฝ์์ ์คํ๋๊ธฐ๋๋ฌธ์ nodejs๋ฅผ ๋ฐ๋์ ์ค์นํด์ผํฉ๋๋ค.
Since it runs in a Node.js environment, you must install Node.js.
https://nodejs.org/ko/download
๐๐ป Watchman์ค์น๋ ๊ถ์ฅํฉ๋๋ค. ์ฝ๋ ๋ณ๊ฒฝ์ฌํญ์ ์ค์๊ฐ ๊ฐ์งํฉ๋๋ค.
Installing Watchman is recommended. It detects code changes in real time.
brew install watchman
๐๐ป Expo GO ์ฑ ์ค์น / Install Expo Go
โ๏ธ ์ฌ๋ฌ๋ถ์ ๋ชจ๋ฐ์ผ ํฐ์ ์ฑ์คํ ์ด๋ ํ๋ ์ด์คํ ์ด์์ Expo Go ์ฑ์ ์ค์นํฉ๋๋ค.
Install the Expo Go app from the App Store or Play Store on your mobile phone.
๐๐ป 1.ํ๋ก์ ํธ ์์ / project start
ย โ๏ธ ํฐ๋ฏธ๋์์ ์๋์ ๋ช
๋ น์ด๋ฅผ ์คํํ๋ฉด expo ํ๋ก์ ํธ๋ฅผ ์ค์นํฉ๋๋ค.
Install the expo project by running the following command in the terminal.
โ๏ธ ์ฑ์ด๋ฆ์ ๋ฌผ์ด๋ณด๋ฉด ์
๋ ฅํ๋ฉด๋ฉ๋๋ค. ์ ๋ start-app์ผ๋ก ํฉ๋๋ค.
If it asks for the app name, just enter it. I use ‘start-app’.
npx create-expo-app@latest
...
โ What is your app named? โฆ start-app
2.์์คํฌ ์คํ / run expo app
โ๏ธ ์์ฑ๋ ํ๋ก์ ํธ ๋๋ ํ ๋ฆฌ๋ก ์ด๋ํฉ๋๋ค.(์ค์ํจ!)
Navigate to the created project directory. (Important!)
cd start-app
โ๏ธ ํฐ๋ฏธ๋์์ ์๋์ ๋ช
๋ น์ด๋ฅผ ์
๋ ฅํ๋ฉด QR์ฝ๋๊ฐ ์คํ๋ฉ๋๋ค.
Enter the following command in the terminal to run the QR code.
npx expo start

โ๏ธ ๋ชจ๋ฐ์ผ ํฐ์์ Expo Go ์ฑ์ผ๋ก QR์ฝ๋๋ฅผ ์ค์บํ๋ฉด ๊ธฐ๋ณธ ์ฑํ๋ฉด์ ๋ณผ ์ ์์ต๋๋ค.
You can view the main app screen by scanning the QR code with the Expo Go app on your mobile phone.


3.ํ๋ก์ ํธ ๋ฆฌ์ / project reset
โ๏ธ ๊ธฐ์กด์ ํ๋ก์ ํธ๋ฅผ ์์ ํ ๋ฆฌ์
ํฉ๋๋ค.
Completely reset the existing project.
npm run reset-project
MacBookAir start-app % npm run reset-project
> start-app@1.0.0 reset-project
> node ./scripts/reset-project.js
Do you want to move existing files to /app-example instead of deleting them? (Y/n): y
๐ /app-example directory created.
โก๏ธ /app moved to /app-example/app.
โก๏ธ /components moved to /app-example/components.
โก๏ธ /hooks moved to /app-example/hooks.
โก๏ธ /constants moved to /app-example/constants.
โก๏ธ /scripts moved to /app-example/scripts.
๐ New /app directory created.
๐ app/index.tsx created.
๐ app/_layout.tsx created.
โ
Project reset complete. Next steps:
1. Run `npx expo start` to start a development server.
2. Edit app/index.tsx to edit the main screen.
3. Delete the /app-example directory when you're done referencing it.
MacBookAir start-app %
4.์ฝ๋์์ / Code modification
โ๏ธ ํ๋ก์ ํธ ๋๋ ํ ๋ฆฌ ๋ด์์ app ๋๋ ํ ๋ฆฌ๋ก ์ด๋ํฉ๋๋ค.
Navigate to the app directory within the project directory.
โ๏ธ ๊ธฐ์กด์ index.tsxํ์ผ์ ๋ค๋ฅธ์ด๋ฆ์ผ๋ก ๋ฐฑ์
ํฉ๋๋ค.(์: b_index.tsx)
Back up the existing index.tsx file with a different name (e.g., b_index.tsx).
MacBookAir app % ls
_layout.tsx b_index.tsx index.js
MacBookAir app %
โ๏ธ ์๋ฐ์คํฌ๋ฆฝํธ๋ฅผ ์ฌ์ฉํ๊ธฐ ์ํด์ index.jsํ์ผ์ ์์ฑํ๊ณ ์๋์ ์ฝ๋๋ฅผ ์
๋ ฅํฉ๋๋ค.
To use JavaScript, create an index.js file and enter the following code.
— tsx๋ ํ์
์คํฌ๋ฆฝํธ ํ์ผ์
๋๋ค.
tsx is a TypeScript file.
— index.tsx๋ผ๋ ๊ธ์๋ฅผ index.js๋ก ์์ ํ์ต๋๋ค.
I changed the text ‘index.tsx’ to ‘index.js’.
import { Text, View } from "react-native";
export default function Index() {
return (
<View
style={{
flex: 1,
justifyContent: "center",
alignItems: "center",
}}
>
<Text>Edit app/index.js to edit this screen.</Text>
</View>
);
}
— Expo Go์์ ํ์ธํ๋ฉด ๋ค์๊ณผ ๊ฐ์ ํ๋ฉด์ ๋ณผ ์ ์์ต๋๋ค.
If you check on Expo Go, you can see the following screen.
