Questions tagged [react-native-image-picker]

This package is the basic package by react native community to upload an image from your gallery or camera.

This is the way it opens on click in iOS

This way it opens in android on a click

A React Native module that allows you to use native UI to select a photo/video from the device library or directly from the camera. You have to specify both permission of accessing camera and gallery in both platforms(android and iOS).

A code snippet to simplify:

import ImagePicker from 'react-native-image-picker';

// More info on all the options is below in the API Reference... just some common use cases shown here
const options = {
  title: 'Select Avatar',
  customButtons: [{ name: 'fb', title: 'Choose Photo from Facebook' }],
  storageOptions: {
    skipBackup: true,
    path: 'images',
  },
};

/**
 * The first arg is the options object for customization (it can also be null or omitted for default options),
 * The second arg is the callback which sends object: response (more info in the API Reference)
 */
ImagePicker.showImagePicker(options, (response) => {
  console.log('Response = ', response);

  if (response.didCancel) {
    console.log('User cancelled image picker');
  } else if (response.error) {
    console.log('ImagePicker Error: ', response.error);
  } else if (response.customButton) {
    console.log('User tapped custom button: ', response.customButton);
  } else {
    const source = { uri: response.uri };

    // You can also display the image using data:
    // const source = { uri: 'data:image/jpeg;base64,' + response.data };

    this.setState({
      avatarSource: source,
    });
  }
});

Then later, you can display this image in your render() method.

304 questions
1
vote
1 answer

Apple store demands audio permissions in {mediaType: 'photo'}

I'm using only photo mode but from spring 2019 apple store demands permission for micro. It will be very confusing for user to grant permissions for micro when he is using only photo. Is there any workaround for this problem?
1
vote
3 answers

returns an error 'null is not an object (evaluating 'imagepickermanager.showimagepicker')' while calling method onpress

when i try to access the photos using react-native-image-picker it returns an error 'null is not an object(evaluating 'ImagePickerManager.showImagePicker')'. i have tried linking the libraries deleting node modules and then again etc but none…
vishnu
  • 213
  • 1
  • 13
1
vote
0 answers

Uploading image to S3 on Postman works but it doesn't work when I use React Native Image Picker

My Rails API seems to be working fine, when I POST an image to S3 via postman. However, when I use React Native image picker, I don't think I'm sending the parameters in the correct way. I am currently sending the image uri as the image parameter…
1
vote
1 answer

After Image Uploading, image uri is null for iOS alone in React Native

In my React Native app, I have added an functionality to upload multiple images, which will be stored as image[] including uri. This works perfectly for Android. But for iOS, the image[] is created also contains some data but it is entirely…
1
vote
1 answer

How can I rename the captured image in react native begore uploading to aws s3?

I am beginner in react native. I want to rename the image before uploading to AWS s3. Till uploading to AWS s3 I have done. But I am not getting how to rename the image before uploading. For example, my captured image name is :…
1
vote
1 answer

Unable to display image using react-native-image-picker

I'm trying to integrate react-native-image-picker and I was able to successfully install it. Now when I try to choose image from gallery in log it does shows that my imageSource has value but it doesn't display. I'm currently running it on iOS…
Francis F
  • 3,157
  • 3
  • 41
  • 79
1
vote
1 answer

react-native-image-picker duration of video

I'm using react-native-image-picker library for video recording and react-native-video to play video in which duration of video in onLoad callback function is given but how can I use it in my code can anyone please guide me? I have written…
1
vote
1 answer

Can not use ImagePicker on iOS in react native

I have a problem for using ImagePicker in react native. I have installed the module using the command npm install react-native-image-picker. And link the module using react-native link. And also configure for Android and iOS. For iOS, add following…
Water Flower
  • 377
  • 7
  • 23
1
vote
2 answers

react-native-image-picker how to save image with customize filename

I am trying to develop an android application using react-native. and one of the requirement is to automatically save the capture image based on pre-defined filename programmatically. I am using react-native-image-picker. The API of image-picker…
1
vote
1 answer

I Want to capture multiple images using react-native-image-picker

// add no of images equal to Qty handleQuantity(qty) { this.setState({ qty: qty }) for (let i = 0; i < qty; i++) { this.selectPhotoTapped(i) } } selectPhotoTapped(count) { const options = { quality: 1.0, …
1
vote
2 answers

react-native-elementes Avatar

I'd like to upload an image by clicking on avatar component and then pick a picture from the device. Anyone knows if its possible using avatar component from react-native-elements? I have already added the permissons below:
1
vote
1 answer

react native iOS image picker very slow on simulator

I am using react native to create an app. I am using npm image picker library to access to camera and photo library. It works fine with the real device, however, when I run it with my simulator it gets immensely slow. The tab bar shows up slow and…
kirimi
  • 1,370
  • 4
  • 32
  • 57
1
vote
1 answer

How to pass an image picker image souce from one navigation view to another navigation view?

I am new to react native and I am currently making an image/video capturing app using ImagePicker package. I have two separate buttons - one for image capturing and one for video capturing. My problem is that currently my images are being displayed…
0
votes
0 answers

react native image picker give an errror: Cannot read property 'launchImageLibrary' of null

i have an issue in react native image picker when the function launchImageLibrary called then it gave an error [TypeError: Cannot read property 'launchImageLibrary' of null] const ImagePicker = async () => { try { const result =…
0
votes
0 answers

My react-native project brakes after installing react-native-image-picker but it works fine if i uninstall it

My React Native project brakes after installing react-native-image-picker but it works fine if I uninstall it. It brakes with this error message. import undefined.ImagePickerPackage; ^ C:\Users\uchen\Documents\My…