[React Native] react-native-camera 사용법

[React Native] react-native-camera 사용법

오늘 사용할 라이브러리

https://github.com/react-native-community/react-native-camera

0) 환경

- react-native: 0.61.5

1) 설치

yarn: yarn add react-native-camera@git+https://git@github.com/react-native-community/react-native-camera.git npm: npm install --save react-native-camera@git+https://git@github.com/react-native-community/react-native-camera.git

cd ios && pod install && cd ..

2-1) [iOS] Info.plist에 추가

NSCameraUsageDescription Camera를 사용합니다

2-2) [Android] AndroidManifest.xml에 추가

3) Usage

import {RNCamera} from 'react-native-camera';

- captureAudio 를 써주지 않으면 크래시가 난다.

- type은 전면/후면 카메라. RNCamera.Constants.Type.back를 쓰면 후면, RNCamera.Constants.Type.front를 쓰면 전면 카메라를 이용할 수 있다

아주 간단하다!!!

도움이 되셨다면 공감/댓글 남겨주세요^^

from http://coding-dahee.tistory.com/147 by ccl(A) rewrite - 2020-03-19 05:20:14

댓글

이 블로그의 인기 게시물

[React] - 18) 프로젝트 빌드하기(+코드 스플리팅)

단위 테스트 환경 구축

React에서 웹팩 설치하기