0.0.2 • Published 5 years ago

rn-camera v0.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

rn-camera

With rn-camera you are able access the camera and image library of iOS and Android devices using simple JavaScript functions.

Installation

Install the package as a dependency of your project:

npm install rn-camera

Link the native module:

react-native link rn-camera

Open camera

import Camera from 'rn-camera';

const [image, setImage] = useState(null);

Camera.openCamera({ save: true, quality: 1.0, frontCamera: false }, (result) => {
  setImage(result.uri);
});

The first parameter is an object that defines configuration for the camera, it accepts the following fields:

Option fieldDescriptionDefaultPlatform
savesaves photo in camera row (optional)trueiOS / Android
qualitydefines the quality of the photo using values from 0.0 to 1.0 (optional)1.0iOS / Android
frontCamerastart camera using frontal camera (optional)falseiOS

Open Image Library

import Camera from 'rn-camera';

const [image, setImage] = useState(null);

Camera.openImageLibrary({}, (result) => {
  setImage(result.uri);
});

There's also available an example project using the native module.