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
0 answers

react-native-image-picker store a link to the selected image persistently

I am building an app that let's the user take a picture or select an image from the camera roll. I want to store a link to that image with @react-native-async-storage/async-storage. When I use react-native-image-picker to select an image or take a…
0
votes
1 answer

ImagePicker.showImagePicker is not a function

I am trying to use ImagePicker.showImagePicker and I get an Exception: ImagePicker.showImagePicker is not a function My code looks something like ImagePicker.showImagePicker(options, response => { console.log('Response = ', response); if…
AYBABTU
  • 986
  • 3
  • 17
  • 39
0
votes
1 answer

Possible Unhandled Promise Rejection (id: 9): TypeError: undefined is not an object When upload react native axios

I'm trying to upload in react-native but have no luck after many tries. Someone please help me out of this problem? Thank you verymuch const handleChoosePicture = () => { launchImageLibrary({ noData: true }, (response) => { if (response)…
Nam Apple
  • 3
  • 2
0
votes
1 answer

expo how i read an image

I successfully uploaded an image with imagepicker and multer to my folder "uploads/". I also send the filename back to the client: res.send({uploadedImage: req.file.path}); // Result: Object { "uploadedImage":…
localdata01
  • 587
  • 7
  • 17
0
votes
2 answers

How to display the image on screen which is taken from camera

I am using react-native-image-picker to take image. Below is the code for this: const chooseImage = () => { ImagePicker.launchCamera( { mediaType: 'photo', includeBase64: false, maxHeight: 1000, maxWidth:…
0
votes
1 answer

How to capture and render multiple images by camera (react native image picker) in react native app

I want to capture and render 3 different different images In react native app. how can I do this. now I am able to click image but when I click image then same image is rendering 3 times but I want to click image one by one. here is my…
user14877357
0
votes
1 answer

after installing image crop picker and debug problem

my all project is working fine but when i install image crop picker dependency then it shows the error even there is no build. FAILURE: Build failed with an exception. Error given below What went wrong: Execution failed for task…
sherkhan
  • 811
  • 8
  • 8
0
votes
1 answer

React native how to save image picked from image-picker package

Hi everyone I'm trying to make an app like an album. Simply 2 options, Open camera, Pick from library. I can capture and pick from library ( i will show it on code). So the problem is I want to save captured or selected image in created custom…
mongoman
  • 69
  • 2
  • 9
0
votes
1 answer

react-native-image-picker+axios uploads fail on Android

I have an app where I use react-native-image-picker to take and select photos. Then I use axios and FormData to upload the selected files to my backend. This works fine on iOS, where I can just take the URL from the image picker, and add it to my…
0
votes
2 answers

Expo React Native, How to pick default local images or user image obtained from expo image picker

I have a form that a user can select a default local image or an image from the user's photo library Here is an expo snack use android the images can be found in the phone menu in photos I want to save either the default local image or user's image…
0
votes
1 answer

Video compression before uploading to Google Cloud Storage

I am a bit confused when it comes to the size of a video. I am currently using a signedUrl in order to send the video from the client phone to the Google Cloud Storage bucket. The part I am confused is in regards to the size of the video. I noticed…
0
votes
0 answers

Diffrent results for the image and screenshot of the image

I am using an object localizer with react native image picker to get coordinates of objects within an image. When I send the image by taking a photo with the android device the results I get are not accurate but when I take the screenshot of the…
0
votes
0 answers

Concert image data: URI to file:/// react native

I need help here. I have an image data URI and I want to convert it to file:/// i.e.…
Rich
  • 155
  • 1
  • 8
  • 23
0
votes
4 answers

Expo Image Picker: Unhandled promise rejection: TypeError: undefined is not an object

I am currently working on a small app and I want load images from camera roll into the app. I've build a component to do so with the help of the Expo Image Picker at its documentation. Sadly, I always get the following warning in my expo client and…
0
votes
1 answer

Image upload with axios react native android

I am trying to upload image to an API the iOS version is working good but there is problem in android, My code is bellow. const uploadUri = Platform.OS === 'ios' ? uploadImageFile.replace('file:', '') : uploadImageFile; //…