[React Native] Expo๋? (feat. ์ค์นํ๋ ๋ฐฉ๋ฒ)
์๋ ํ์ธ์ Foma๐ป ์ ๋๋ค.
๋ณธ๊ฒฉ์ ์ผ๋ก ๋ฆฌ์กํธ ๋ค์ดํฐ๋ธ ๊ณต๋ถ๋ฅผ ์์ํ๋๋ฐ์.
๊ทธ ์ค ์ด๋ณด์๊ฐ ์ ๋ฌธํ๊ธฐ ์ฌ์ด Expo์ ๋ํด์ ์์๋ณด๊ณ ์ค์นํ๋ ๋ฐฉ๋ฒ์ ๋ํด ์ ๋ฆฌํ๋ ค๊ณ ํฉ๋๋ค.
๋ฐ๋ก ์์ํ ๊ฒ์~
React native๋ฅผ ๊ฐ๋ฐํ ์ ์๋ ๋ฐฉ๋ฒ์ ํฌ๊ฒ ๋ ๊ฐ์ง๊ฐ ์์ต๋๋ค.
1. React-Native-CLI
React-Native-CLI๋ ์ด๋ ํ ํด์ ์ฌ์ฉํ์ง ์๊ณ ์ค๋ก์ง React natvie๋ง์ ์ด์ฉํด์ ๊ฐ๋ฐํ๋ ๋ฐฉ์์ ๋๋ค.
์ด๊ฒ์ ์ด๊ธฐ์ ์ค์ ์ด ๊น๋ค๋กญ๊ณ , Android Studio, Xcode ๋ฑ์ผ๋ก ๊ฐ ํ๋ซํผ๋ง๋ค ์ค์นํ๊ณ ๋น๋ํด์ผ ํ๋ ๋จ์ ์ด ์์ง๋ง
๊ฐ๋ฐ์ ์ํ๋ ๊ธฐ๋ฅ์ด๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ค์ ์์ ๋กญ๊ฒ ์ ์ด ๊ฐ๋ฅํ ์ฅ์ ์ด ์์ต๋๋ค.
2. Expo-CLI
Expo-CLI๋ ์ด๊ธฐ์ ์ค์ ์ด ๊ฐ๋จํ๊ณ , ๊ฐ๋ฐ์ ์ฝ๊ฒ ํ ์ ์์ผ๋ฉฐ ํนํ ๊ฐ ํ๋ซํผ IDE๋ฅผ ์ค์นํ์ง ์๊ณ ๋ ์๋ฎฌ๋ ์ดํฐ๋ฅผ ์ฌ์ฉํ ์ ์๋ ๊ฒ์ด ํฐ ์ฅ์ ์ ๋๋ค.
ํ์ง๋ง ๋ค์ดํฐ๋ธ ํ์ผ์ ์ ์ดํ ์ ์๊ณ , ๋ชจ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ ์๋ ์์ผ๋ฉฐ Expo์์ ์ ๊ณ ์๋ ๊ธฐ๋ฅ๋ง ์ฌ์ฉ์ด ๊ฐ๋ฅํ๋ค๋ ๋จ์ ์ด ์์ต๋๋ค.
์ด ๋ ๊ฐ๋ฐ ๋ฐฉ์ ์ค์ ์ ๋ฆฌ์กํธ ๋ค์ดํฐ๋ธ๋ฅผ ์ฒ์ ์ ํด๋ณด๊ธฐ ๋๋ฌธ์ ์ฐ์ Expo-CLI๋ก ๊ฐ๋ฐ์ ์งํํด๋ณด๊ณ ์ฌ๋ฌ ๋จ์ ๋ค์ด ๋๊ปด์ง๋ค๋ฉด React-Native-CLI๋ก ๋์ด๊ฐ ์๊ฐ์ ๋๋ค.
Expo๋?
๊ณต์ ๋ฌธ์์ ์๋์ ๊ฐ์ด ์๊ฐํฉ๋๋ค.
Expo is a framework and a platform for universal React applications. It is a set of tools and services built around React Native and native platforms that help you develop, build, deploy, and quickly iterate on iOS, Android, and web apps from the same JavaScript/TypeScript codebase. - Expo -
๊ฐ๋จํ๊ฒ ํด์ํ๋ฉด ์๋์ ๊ฐ์ต๋๋ค.
'Expo๋ JavaScript๋ TypeScript๋ก iOS,Android,Web ์ฑ์ ๊ฐ๋ฐํ ์ ์๋ ํ๋ ์์ํฌ์ด์ ํ๋ซํผ์ด์ผ!'
์กฐ๊ธ ๋ ๊ตฌ์ฒด์ ์ผ๋ก ์ค๋ช ํ๋ฉด ๋ฆฌ์กํธ ๋ค์ดํฐ๋ธ ํฌ๋ก์ค ํ๋ซํผ์ผ๋ก ๊ฐ๋ฐํ๊ธฐ ์ํ ๋น๋๋๊ตฌ์ด๋ฉฐ, ๋ค์ดํฐ๋ธ ๋ชจ๋์ ๋ณด๋ค ์ฝ๊ณ ํธํ๊ฒ ์ฌ์ฉํ ์ ์๊ฒ ๋์์ฃผ๋ XDE์ ๋๋ค.
Pricing
Expo๋ ๋ฌด๋ฃ ๋ฒ์ ๊ณผ ์ ๋ฃ ๋ฒ์ ์ด ๋๋ ์ ธ ์๋๋ฐ์.
๋ฌด๋ฃ์ ์ ๋ฃ๋ฅผ ๋น๊ตํด๋ณด๋ฉด ๋ฌด๋ฃ๋ง ์ฌ์ฉํด๋ ๊ฑฐ์ ๋ชจ๋ ๊ธฐ๋ฅ์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
์ด๊ธฐ ์ธํ
Expo๋ฅผ ์ค์นํ๊ธฐ ์ํด์ ๋จผ์ Node.js, Visual Studio Code, Android Studio,Xcode(๋งฅ ์ ์ ๋ผ๋ฉด)๊ฐ ์ค์น๋์ด ์์ด์ผ ํฉ๋๋ค.
(์๋์ฐ ๊ธฐ์ค์ผ๋ก ์ค๋ช ๋๋ฆฌ๊ฒ ์ต๋๋ค.)
Node.js ์ค์น
๋ค์ด๋ก๋ | Node.js
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
nodejs.org
Visual Studio Code ์ค์น
Visual Studio Code - Code Editing. Redefined
Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications. Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows.
code.visualstudio.com
Android Studio ์ค์น
Download Android Studio and SDK tools | Android Developers
The official IDE for Android app developers.
developer.android.com
Xcode ์ค์น (๋งฅ ์ ์ ๋ผ๋ฉด)
Xcode - Apple Developer
Xcode includes everything you need to create amazing apps for iPhone, iPad, Mac, Apple Watch, and Apple TV.
developer.apple.com
Expo-CLI ์ค์น
cd ์ํ๋ ๊ณณ
npm install expo-cli
๋ง์ฝ Window PowerShell PSSecurityException ์ด ์์คํ ์์ ์คํฌ๋ฆฝํธ๋ฅผ ์คํํ ์ ์์ผ๋ฏ๋ก ... ์ด์ ๊ฐ์ ์๋ฌ๊ฐ ๋ฌ๋ค๋ฉด ์๋ ๊ธ์ ํ์ธํด์ฃผ์ธ์.
[Error ํด๊ฒฐ๋ฒ ํฌํจ] Window PowerShell PSSecurityException ์ด ์์คํ ์์ ์คํฌ๋ฆฝํธ๋ฅผ ์คํํ ์ ์์ผ๋ฏ๋ก ..
React Native๋ฅผ ๋ณธ๊ฒฉ์ ์ผ๋ก ์์ํ๋ ค๊ณ expo์์ ์ฑ์ ์์ฑํ๋ ๊ณผ์ ์์ ์๋์ ๊ฐ์ ์ค๋ฅ๊ฐ ๋ฐ์ํ๋ค. ๋ฐ์ํ ์ด์ ๋ ์ด๊ฒ์ ์ค์นํ ๊ถํ์ด ์๋ค๋ ๊ฒ์ธ๋ฐ, ๋งฅ์์๋ sudo๋ก ํด๊ฒฐํ๋ฉด ๋์์ง๋ง windo
fomaios.tistory.com
expo ํ๋ก์ ํธ๋ฅผ ์ด๊ธฐํ ํด์ค๋๋ค.
expo init "์ํ๋ ํ๋ก์ ํธ ์ด๋ฆ"
blank - a minimal app as clean as an empty canvas๋ฅผ ์ ํํด์ค๋๋ค.
๊ทธ๋ฌ๋ฉด ๋ค์ด๋ก๋๊ฐ ์งํ๋๊ณ
์ฑ๊ณต์ ์ผ๋ก ํ ํ๋ฆฟ์ด ๋ง๋ค์ด์ก๋ค๋ฉด ์๋์ ๊ฐ์ ํ๋ฉด์ด ๋ฐ๊ฑฐ์์.
๊ทธ ๋ค์ ์๋์ ๊ฐ์ด ์น๋ฉด ํด๋น ํ๋ก์ ํธ๊ฐ Visual Studio Code๋ก ๋ฐ๊ฑฐ์์.
code .
๋น์ฅฌ์ผ ์คํ๋์ค ์ฝ๋์์ ์ ํฐ๋ฏธ๋์ ๋ง๋ค๊ณ
ํฐ๋ฏธ๋์ ํด๋น ์ฑ์ผ๋ก ์ด๋ํ ๋ค npm start๋ฅผ ํด์ค๋๋ค.
์ด๋ ๊ฒ ํ๋ฉด ์๋์ ๊ฐ์ด ๋ก์ปฌํธ์คํธ๋ก ์๋ฒ๊ฐ ๋ฐ๊ฑฐ์์.
cd "ํ๋ก์ ํธ ์ด๋ฆ"
npm start
ํด๋น ์ฃผ์๋ก ์ด๋ํ๋ฉด ์๋์ ๊ฐ์ ์ฌ์ดํธ๊ฐ ๋ฐ๊ฑฐ์์.
์ด ์ค ์ํ๋ ํ๋ซํผ ๊ฐ์๊ธฐ๊ธฐ๋ฅผ ์ ํํด์ ํ์ธํ ์ ์์ต๋๋ค.
(๋จ, ํด๋น IDE๊ฐ ์ค์น๋์ด ์์ด์ผ ํฉ๋๋ค.)
๋๋ ํด๋ํฐ์ Expo Go๋ฅผ ์ค์นํ ๋ค
ํด๋ํฐ์ผ๋ก QR์ฝ๋๋ฅผ ์ค์บํ๋ฉด ์๋์ ๊ฐ์ด ํ๋ฉด์ด ๋์ค๋ ๊ฒ์ ๋ณผ ์ ์์ต๋๋ค.
์ฝ๋๋ฅผ ๋ณ๊ฒฝํ๋ฉด ์ค์๊ฐ์ผ๋ก ๊ธฐ๊ธฐ๋ ๊ฐ์ ๊ธฐ๊ธฐ๊ฐ ๋ฆฌํ๋ ์ฌ ๋๋ ๊ฒ์ ๋ณผ ์ ์์ต๋๋ค.
Expo๋ฅผ ์ด์ฉํด์ ์ค์น๋ฅผ ํ๊ณ ์ด๊ธฐ ์ฑ์ ์คํ์์ผ ๋ณด์๋๋ฐ, ์ ๋ง ๊ฐ๋จํ๊ณ ์ค์๊ฐ์ผ๋ก ์ฝ๋๊ฐ ๋ฐ๋๋ ๊ฒ์ด ์ ๊ธฐํ๋ค.
๋ ์ฑ์ ์ ๋ฒ์ ์ ์ฌ๋ฐฐํฌ ์์ด ์ฝ๋ ์์ ๋ง์ผ๋ก๋ ์ ๋ฐ์ดํธ ๊ฐ๋ฅํ๋ค๋๋ฐ.. ์ง์ง ๊ธฐ๋๋๋ค.