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
0
votes
1 answer

File is empty in Symfony after uploading with react-native-fetch-blob

I want to upload a picture from react-native to PHP Symfony server. I pick the picture with ImagePicker.showImagePicker and send it with RNFetchBlob.fetch, but in Symfony the file seems to be empty. The $file->getMimeType() return "file does not…
0
votes
1 answer

Is there any size restriction in using react-native-image-picker?

I want to if there is any size restriction for the image I needed to upload using react-native-image-picker. Because when I try to upload an jpg image having size 33MB, the app crashes showing "appName has stopped working". But at the same time I'm…
Vinay N
  • 249
  • 1
  • 8
  • 32
0
votes
1 answer

Add selected image to horizontal listView

I using multi_image_picker plugin for my project and it works perfectly. Now I trying to modify the code so that the selected images will be displayed in horizontal ListView instead of GridView. But I get below exception I/flutter (18429): Another…
Hoo
  • 1,806
  • 7
  • 33
  • 66
0
votes
1 answer

How to display video with "content://" tag on react-native-video component?

I want to show video from device video gallery. I get response from react-native-image-picker that include path and content. When I use the content for display video with react-native-video component shows nothing. I tried these…
0
votes
1 answer

I am getting "Illegal callback invocation from native module. This callback type only permits a single invocation from native code."

I am getting an error as "Illegal callback invocation from native module. This callback type only permits a single invocation from native code." I have used react-native-image-crop-picker to crop an image, now If I choose the cropped image I am…
sejn
  • 2,040
  • 6
  • 28
  • 82
0
votes
1 answer

expo image upload promise rejection ImagePicker.launchImageLibraryAsync error

I am trying to upload image using expo image picker but when click button and select image it gives unhandled promise rejection _expo.default.launchImageLibraryAsync error already added camera storage permissions in app json import React from…
0
votes
2 answers

Keyboard Focus() not working in react native

In here I am trying to do very basic thing. First I focus on TextInput while focus on that I am using imagepicker to take photo. After I take it and come back My keyboard getting hide. I used focus() method after saving the image. In iOS its getting…
0
votes
2 answers

Unable to launch cropping window using react-native-image-picker

I need to launch the cropping window using react-native-image picker. But the below-mentioned code snippet not worked for me. Any suggestions ImagePicker.launchImageLibrary(options, (response) => { if (response.didCancel) { …
sejn
  • 2,040
  • 6
  • 28
  • 82
0
votes
1 answer

Uploading image to firebase in react native: undefined is not a function

As the title says, I'm trying to upload Image to firebase in react native. I'm using react-native-image-picker and firebase modules for that. My code goes as: (Only including the "main" parts for clarity) import ImagePicker from…
0
votes
1 answer

why will i get error react-native-image-picker : NativeModule.ImagePickerManager is null

I have been on this issue for about 3days now and I have tried everything within my power. React Native gives me the error react-native-image-picker : NativeModule.ImagePickermanger is Null. To fix this issue, try these steps; Run react-native…
Nges Brian
  • 479
  • 1
  • 8
  • 22
0
votes
1 answer

ImagePicker Error: Permissions weren't granted in React native version 0.59.9 & 0.59+

I am using react-native-image-picker of version 0.28.1 as per their document I think I am using right version of image-picker as per my react-native version. Also added permissions in AndroidManifest.xml but getting me error "ImagePicker Error: …
Mayuresh Patil
  • 2,072
  • 1
  • 21
  • 44
0
votes
1 answer

ReferenceError: Can't find variable: Permissions and ReferenceError: Can't find variable: ImagePicker

I ejected my react-native project and am testing it with android studio. However, I keep getting the error: ReferenceError: Can't find variable: Permissions ReferenceError: Can't find variable: ImagePicker I have an upload button that lets the user…
0
votes
0 answers

Error in linking react-native-imagepicker

When I tried linking react-native-imagepicker with react-native it gives error : Failed to get dependency config. react-native-imagepicker @2.0.0 react-native@0.59.8
0
votes
0 answers

Response from ImagePicker doesn't contain Data

My code snippet: showImagePicker = () => { const options = { storageOptions: { skipBackup: true }, mediaType: 'video', videoQuality: 'high', durationLimit: 10, allowsEditing: true, …
0
votes
1 answer

How to optimise an Image in React Native and view on latest iPhone models

Photos captured via camera are too large for efficient upload and download in React native. Also i am facing issues in displaying images in latest iPhone models like X, XS, XSMax and XR I am using the npm package react-native-image-picker. Though it…
Aarsh Oza
  • 164
  • 1
  • 4
  • 19