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

Detect touch and draw rectangular box on bitmap image using react native

I've been looking for references for some time on how to draw rectangles in an image using react native, but I can not find anything. What I try to do is something like the user touch on the screen to mark the start position, and move, and release…
2
votes
0 answers

React Native - iOS App stuck after image selection and Image doesn't display on imageview

I am new to React Native and I am trying to show image from Gallery in my app. After picking the image from Gallery, image doesn't display on app and the button (i.e., TouchOpacity) and back navigation button also stops working. Please help me out…
2
votes
2 answers

How to compress image only when it's too large with react-native-image-picker

I'm using react-native-image-picker and I want to compress images in order to send them faster to my server. Right now setting the option "quality" to 0.5 works just fine, but I don't want to compress small images too. I rather keep them untouched…
Zeynab Rostami
  • 423
  • 4
  • 13
2
votes
1 answer

How Expo(React Native) can access gallery and external storage without CAMERA_ROLL permission?

I have a terrible question.. I hope there is anyone who know this problem.. In EXPO App which is a wrapper API for React Native, How can Expo Image picker example app can access Gallery(external storage) without requesting any external storage…
2
votes
1 answer

React native image picker is not selecting video from library in iOS 13 or higher

React native image picker with version 0.28.0, react native 0.59.5 and iOS version less than 13 was working fine. But after upgrade to iOS 13+, it does't select videos from library and returns permission error in response.How to achieve specific?
2
votes
2 answers

Expo Imagepicker asks for permissions but nothing else happens

I'm using expo to build a react-native app. I'm trying to implement the expo imagePicker so the user can pick an image from their gallery or camera roll and use it on the app however after the ImagePicker ahs asked for permissions and I allow them,…
SK1dev
  • 1,049
  • 1
  • 20
  • 52
2
votes
2 answers

React Native NativeModule.ImagePickermanager is null

I'm trying to use react-native-image-picker, but I'm getting the error: NativeModule.ImagePickermanager is null. import React, { Component } from 'react'; import { Text, View, StyleSheet, Alert, PixelRatio, Image } from 'react-native'; import…
myTest532 myTest532
  • 2,091
  • 3
  • 35
  • 78
2
votes
0 answers

React native Get index of TextInput from multiple Photos

Multiple photos from the device camera are being selected and passed to a flatlist component, and i have textinput at the bottom which lets text be added underneath each photo. I want to get the index of the text input passed as props but it says…
endlessCode
  • 1,255
  • 4
  • 21
  • 36
2
votes
3 answers

react-native-image-picker uri doesn't persist for android

according to the documentation: On iOS, don't assume that the absolute uri returned will persist. See #107 I'm testing it on my android(Xiaomi) device and it works fine when I choose an image, but after closing the app and opening it again or…
Reza Shoja
  • 887
  • 2
  • 11
  • 24
2
votes
0 answers

Expo ImagePicker not working properly in android

Asked permission in componentDidMount async componentDidMount() { await Permissions.askAsync(Permissions.CAMERA); await Permissions.askAsync(Permissions.CAMERA_ROLL); } Photo picker function _takePhoto = async () => { let pickerResult = await…
Sibiraj PR
  • 1,481
  • 1
  • 10
  • 25
2
votes
1 answer

Expo/Firebase: Image chosen from camera roll uploading as octet-stream instead of .jpg

I've been having trouble viewing the image files I've uploaded to firebase and just noticed the issue is with the file type in firebase. Two files in my firebase storage console. One uploaded from my IOS simulator (octet-stream) and the other…
2
votes
3 answers

React Native: Image not displaying with dynamic/local URI

so I'm trying to display an Image with a dynamic uri/path (at initialization it displays a placeholder image, and then later changes) like so:
SSBakh
  • 1,487
  • 1
  • 14
  • 27
2
votes
1 answer

React-native upload Image as FormData

Need to Post image as formData in React-Native The Form Data: ------WebKitFormBoundary4df7ukBk3N8GDzOl Content-Disposition: form-data; name="selfieImage"; filename="600px-Google_Drive_logo.png" Content-Type:…
WilTree
  • 130
  • 1
  • 2
  • 12
2
votes
3 answers

how to show videos and images with react-native-image-picker in react native

import ImagePicker from 'react-native-image-picker'; const options = { title: 'Select Image', takePhotoButtonTitle:'take a photo', chooseFromlibraryButtonTitle:'choose from gallery', quality:1 }; class Upload…
Aoudesh Jaiswal
  • 148
  • 2
  • 13
1
vote
1 answer

React Native Image Picker Is causing the Build failed

Hi This is my first app in react native. I am trying to Use react-native-image-picker. But it is not allowing me to build the app. I am getting the following error FAILURE: Build failed with an exception. * What went wrong: Could not determine the…