Silicon Mac에서 React-Native TypeScript 프로젝트 ios Simulator Setup

YeongUk·2022년 7월 29일
2

React-Native

목록 보기
1/1
post-thumbnail
  1. xcode가 설치 되어 있지 않다면 App Store에서 설치

  2. home brew가 설치 되어 있지 않다면 Homebrew 설치

  3. node.js가 설치 되어 있지 않다면 brew install node 명령어로 설치

  4. react native를 run 하기 위한 세팅

    brew install watchman
    
    arch -x86_64 sudo gem install cocoapods
    arch -x86_64 sudo gem install ffi
    arch -x86_64 pod install
  5. ReactNative 설치

    npm install -g react-native-cli

6번 부터는 공식 문서를 보면 쉽게 할 수 있다.


  1. TypeScript 프로젝트 생성

    npx react-native init MyApp --template react-native-template-typescript
    
    yarn add -D typescript @types/jest @types/react @types/react-native @types/react-test-renderer
  2. tsconfig.json 수정

    {
      "compilerOptions": {
        "allowJs": true,
        "allowSyntheticDefaultImports": true,
        "esModuleInterop": true,
        "isolatedModules": true,
        "jsx": "react-native",
        "lib": ["es2017"],
        "moduleResolution": "node",
        "noEmit": true,
        "strict": true,
        "target": "esnext"
      },
      "exclude": [
        "node_modules",
        "babel.config.js",
        "metro.config.js",
        "jest.config.js"
      ]
    }
  3. jest.config.js 파일 생성

    module.exports = {
      preset: 'react-native',
      moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node']
    };
  4. yarn tsc 명령어로 확인 및 npx react-native run-ios

profile
소통과 배움을 통해 개인이 가진 맹점을 극복하려 노력하고 있습니다.

0개의 댓글