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

How do I create the file constructor in React-Native

I need to send a File Object type to Endpoint.React Native does not support File Object type. I will be glad if you help Thank You.
1
vote
1 answer

react-native-image-picker: NativeModule.ImagePickerManager is null

I am trying to use react native image picker in visual studio code. Try steps to link image picker "npx react-native link react-native-image-picker" and its linking successfully but when I run my project I got below error : Error:…
1
vote
1 answer

How to localize crop screen of react-native-image-crop-picker for Android?

For iOS we have 2 props cropperChooseText and cropperCancelText to localize these buttons inside Crop screen ImagePicker.openPicker({ cropperChooseText: 'any text...', //ios only cropperCancelText: 'any text...', //ios only }) and we can add…
Stich
  • 2,331
  • 1
  • 15
  • 31
1
vote
1 answer

Error "Request failed with status code 413" when upload image took by camera in React Native app

I use 'React-native-image-picker' to upload image to my server : const options = { title: 'Chọn ảnh đại diện ', takePhotoButtonTitle: 'Chụp ảnh', chooseFromLibraryButtonTitle: 'Chọn từ thư viện', …
1
vote
2 answers

Unable to use react-native-image-picker on iOS

I'm using react-native-image-picker to select and upload images on server. It works great on android, but throws error on iOS. The npm link have provided a note that "On iOS, don't assume that the absolute uri returned will persist. See #107" what…
shravan bardwa
  • 37
  • 2
  • 11
1
vote
1 answer

expo-image-picker android doesn't have a select button

I am using react native and expo and the expo-image-picker is working great on iOs and mostly great on android with one exception. There is no "okay" or "select" or "done" button when a user pulls a picture from gallery. The user has to click the…
Olivia
  • 1,843
  • 3
  • 27
  • 48
1
vote
1 answer

I am trying to install react-native-image-picker but getting this error

I am trying to install image picker, it gets installed. But then post running android this error is thrown. When I remove installed image picker line from package json, the issue gets resolved. How to I resolve this? FAILURE: Build failed with an…
Sakshi
  • 73
  • 3
  • 12
1
vote
2 answers

How to read image as binary/blob in reactnative

I use react-native-camera to take a picture and it will save in the mobile like file:///data/user/0/xxx/cache/Camera/4b1bde90-fa5e-4f91-aac1-029a8b67b3fc.jpg now I want to upload this image to server and my API scheme is as below const…
1
vote
1 answer

react native : image is uploading using expo-image-picker but not uploading using react-native-image-picker

I have tried uploading images to node js server, It is working fine with expo-image-picker but it is not working in react-native-image-picker by doing this I noticed that the URI between expo and react-native CLI is different by using…
rahul
  • 408
  • 6
  • 21
1
vote
3 answers

upload image to S3 presigned url using react-native-image-picker and axios

I am trying to get an presigned url image upload working correctly. Currently the upload succeeds when selecting an image from the IOS simulator, however when I actually try to view the file it seems the file is corrupted and will not open as an…
Sandra Willford
  • 3,459
  • 11
  • 49
  • 96
1
vote
0 answers

React Native Node Js : Image is not uploading on node js server using react native image picker

Hello I am new to react and I am trying to upload image from react native image picker but it is not uploading to node js server and Image data is not going to backend node js server here is my react native code import React,{useState,useEffect}…
1
vote
0 answers

The react-native image picker should maintain its image even after navigation

Actually i am using react-native image picker and there are different pages. So when i load a image in react-native image picker and navigate to different page and comeback to the same the image is no longer exist. I want that image which was loaded…
1
vote
1 answer

Show photo taken with React Native Image Picker

I'm learning a little bit about React Native and a question came up that I couldn't solve. I'm using react-native-image-picker I have been able to take a photo from my device, the problem is that I cannot show the captured image on the device…
1
vote
0 answers

React Native react-native-image-picker, react-native-fetch-blob workaround to clear images taken from camera

You have probably noticed that storageOptions: { cameraRoll: false } parameter is not working on Android when using react-native-image-picker library. Instead it saves pictures taken from camera to a gallery. Alternatively, storageOptions: { path:…
1
vote
1 answer

Cropping multiple images in react native

What would be the right approach to crop several images at ones in React Native? I'm working on an app where user selects many photos but before uploading them to the server, each photo should have the right aspect ratio - 1:1, 2:3, etc. I'm using…
priteshbaviskar
  • 2,139
  • 2
  • 20
  • 27