Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-image-picker

Package Overview
Dependencies
Maintainers
7
Versions
212
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-image-picker

A React Native module that allows you to use native UI to select media from the device library or directly from the camera

  • 7.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
243K
decreased by-3.67%
Maintainers
7
Weekly downloads
 
Created

What is react-native-image-picker?

The react-native-image-picker package allows React Native developers to access the device's camera and photo library. It provides a simple way to capture images and videos or select them from the device's gallery.

What are react-native-image-picker's main functionalities?

Launch Camera

This feature allows you to launch the device's camera to capture a photo. The `launchCamera` function takes an options object to specify the media type and camera type, and a callback function to handle the response.

import { launchCamera } from 'react-native-image-picker';

const options = {
  mediaType: 'photo',
  cameraType: 'back',
};

launchCamera(options, (response) => {
  if (response.didCancel) {
    console.log('User cancelled image picker');
  } else if (response.error) {
    console.log('ImagePicker Error: ', response.error);
  } else {
    const source = { uri: response.uri };
    console.log('Image URI: ', source.uri);
  }
});

Launch Image Library

This feature allows you to open the device's image library to select a photo. The `launchImageLibrary` function takes an options object to specify the media type and a callback function to handle the response.

import { launchImageLibrary } from 'react-native-image-picker';

const options = {
  mediaType: 'photo',
};

launchImageLibrary(options, (response) => {
  if (response.didCancel) {
    console.log('User cancelled image picker');
  } else if (response.error) {
    console.log('ImagePicker Error: ', response.error);
  } else {
    const source = { uri: response.uri };
    console.log('Image URI: ', source.uri);
  }
});

Video Recording

This feature allows you to launch the device's camera to record a video. The `launchCamera` function takes an options object to specify the media type as video and the camera type, and a callback function to handle the response.

import { launchCamera } from 'react-native-image-picker';

const options = {
  mediaType: 'video',
  cameraType: 'back',
};

launchCamera(options, (response) => {
  if (response.didCancel) {
    console.log('User cancelled video recording');
  } else if (response.error) {
    console.log('VideoPicker Error: ', response.error);
  } else {
    const source = { uri: response.uri };
    console.log('Video URI: ', source.uri);
  }
});

Other packages similar to react-native-image-picker

Keywords

FAQs

Package last updated on 20 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc