본문 바로가기

React + React Native + Expo

React Native setup with TypeScript

반응형

 

 

 

1. reactNative 에서 using typeScript 부분 명령어 입력 

https://reactnative.dev/docs/typescript

 

요 아래 명령어 입력 전 어떤 위치에 해당 프로젝트를 시작할지 미리 경로 들어가있기 

 

$ npx react-native init [MyApp name] --template react-native-template-typescript

-> react-native 등 필요한 것들을 모두 설치가 자동으로 된다. 

 

** 만약  xcode가 설치되지 않은 상태라면 에러가 나온다. 

자세한 해결법은 아래에 👇

https://blckchainetc.tistory.com/386

 

[React Native] xcrun: error: SDK "iphoneos" cannot be located unable to lookup item 'Path' in SDK 'iphoneos' Failed to install C

React Native 를 TypeScript를 사용하여 실행하기 위해 처음 명령어를 입력 후에 $ npx react-native init LuckIsComing --template react-native-template-typescript Failed to install CocoaPods dependen..

blckchainetc.tistory.com

 

해당 프로젝트의 ios 폴더에 들어가서 "$pod install" 을 해야 한다. 

 

$ npm i @types/react-native --save-dev

types/react-native도 설치해주기 

 

 

 

2. ios 켜보기 
어플 프로젝트에 들어와서 아래 명령어 입력

$ npm run ios

이렇게 아이폰이 켜진다. 

그리고 하늘색의 React-native 창이 보인다. 

 

 

이제 기초 윤곽을 잡을 components (screens)를 만들고 render하려는데 나온 에러 

"RNSScreenStackHeaderConfig" was not found in the UIManager.

해결법 : 

https://blckchainetc.tistory.com/385

 

[React Native] "RNSScreenStackHeaderConfig" was not found in the UIManager.

React Native에서 navigator 사용을 위해 아래의 라이브러리 들을 설치했다. $ npm install @react-navigation/native @react-navigation/native-stack 문제가 없다고 생각했는데 나온 에러 ! "RNSScreenStackHea..

blckchainetc.tistory.com

 

 

이제 ios 시뮬레이터가 켜지고 App.js의 내용을 수정하면 바로 수정이 된다. 

반응형