react-native 초기 코드 세팅 과정
1. react-native-cli로 tsx 세팅
npx react-native init app --template react-native-template-typescript
로 리액트 네이티브 설치 후
code app 로 코드 실행
npm start
npm run android
npm run ios
로 android, ios 각각 실행
App.tsx를
import React from 'react';
import { Text } from 'react-native';
export default function App(){
const TextElement = React.createElement(Text, null, 'Hello Word!')
return TextElement
}
로 바꿔서 실행하면 화면에 Hello World! 가 출력됨.
-> 타입스크립트가 너무 어려워서, js로 세팅을 시도했다.
2. react-native-cli로 js 세팅
구글링을 하면 엥간한 예시는 죄다 js를 쓰길래 그냥 다시 app을 만들었다 ^_^
npx react-native init app
로 app 설치
-> App.tsx가 아닌 App.js로 메인페이지가 생성된다 야호
내가 쓸 주 라이브러리인
npm install --save react-native-signature-canvas
를 설치해준다.
-> 수정버전 : https://github.com/xingyuefeng/react-native-signature-canvas
npm start
npx react-native run-ios
npx react-native run-android
그런데 ios 에뮬레이터를 실행하면
Invariant Violation: requireNativeComponent: "RNCWebView" was not found in the UIManager
이런 오류가 떴다..ㅎㅎ
구글링을 해보니,
react-native link
cd ios
pod install
를 하면 된다고 한다. -> 그래도 안되더라 ㅎㅎㅎㅎㅎ
그래서 필요한 라이브러리가 제공된다는 expo로 앱을 설치해보았다.
3. expo로 js 세팅
npm i -g expo-cli
expo --version
expo init app
code app
expo install expo-camera expo-contacts expo-sensors
expo install expo-file-system
-> 이미지 다운위한 라이브러리
Author And Source
이 문제에 관하여(react-native 초기 코드 세팅 과정), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@0909oje/React-Native-코드-기본-세팅저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)