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

How To Upload Image Using Axios React Native?

I use react-native-image-picker, after successfully taking pictures from the camera I want to upload them to the server. This is my Axios PUT code for uploading images: updateBodyTemperature = async () => { try { let fistNumber =…
zidniryi
  • 1,212
  • 3
  • 15
  • 36
0
votes
1 answer

Multiple Image Selection not working in React Native

I tried using react native image crop picker library, but I am not able to integrate it in my project as it keeps giving error "null is not an object (evaluating ImagePicker.openPicker)"
0
votes
1 answer

How do I move a buttom from behind an image using React Native

I have attached a screen shot of the problem. I can't seem to be able to move my button from behind an image object. I tried zIndex and moving my Views around but I am still getting the same issue. The code seems to only work on IOS but not on…
jonson.ncube
  • 226
  • 2
  • 16
0
votes
2 answers

react-native-image-picker reloading the whole app on capturing image

When capturing the photo using react-native-image-picker and saving it, the whole app is being reloaded sometimes. This is not happening all the time, sometimes it is working as expected, but sometimes its reloading the app.…
Sourav Dey
  • 1,051
  • 1
  • 13
  • 21
0
votes
6 answers

form post with file attach throws network error / React Native + react native Image picker

I am using react-native-image-picker to fetch image details and try to upload in https backend server. the request is not successful and it throws network error. It did not esablish the connection with the backend server. The problem is with…
kulls
  • 845
  • 2
  • 12
  • 37
0
votes
1 answer

How can I take photo multiple times using react-native-image-crop-picker

I am using a react-native-image-crop-picker to choose multiple images and taking a photo using a native camera of the device. This code works for choosing multiple photos: ImagePicker.openPicker({ multiple: true, }).then(images => { …
Dilshod K
  • 2,924
  • 1
  • 13
  • 46
0
votes
0 answers

How to configure React Native Image picker styling?

When i'm getting an image from the gallery in react-native-image-picker, i need to: --change the font and colour of the Cancel, Play and Choose buttons --change color of the progress bar from blue color --remove the 'compressing video' text…
chai86
  • 425
  • 2
  • 14
  • 34
0
votes
0 answers

React Native ImagePicker Video Upload

Good day, I have been trying to upload a video taken from camera with ImagePicker to the server, but so far it's failed, i've tried some codes from similar issues here to no avail. I would love to get help on this issue. Thanks My Codes Formdata let…
0
votes
2 answers

Upload an image to Firebase with React Native

i am trying to make a photo uploader to firebase in react native. I followed a tutorial and adopted the code 1-on-1. However, after I want to execute the code everything appears to work until the code has to be uploaded then I get the following…
0
votes
0 answers

react-native-firebase:compileDebugRenderscript FAILED: Could not resolve android.arch.lifecycle:runtime:1.1.0

Please note that posting on StackOverflow is my last choice, and I have already spent hours searching over GitHub issues and related questions. The problem occurred as soon as I added implementation project(':react-native-image-picker') and…
0
votes
1 answer

How to pass image as a navigate parameter in React Native

I'm using Image Picker to get the user photo and then I need to show it in the next screen. How can i achieve this? Image Picker function: const options={ title: 'Profile picture', takePhotoButtonTitle: 'Take picture', …
Mateus99
  • 119
  • 1
  • 2
  • 9
0
votes
2 answers

React-Native-Image-Picker Dialog automatically closes after launching in IOS

Description I am using React-Native-Image-Picker to Select and Upload Files from my App, The issue i am facing that It is working in Android but in ios react-native-image-picker dialog automically closes after launching, therefore i cannot select…
0
votes
1 answer

Unable to show image in react-native

I am a beginner in react-native and presently trying to capture and select images using react-native-image-crop-picker. When I capture the image, I am able to store the path in my state variable. However, when i try to show the image, nothing shows…
Vineet
  • 723
  • 4
  • 12
  • 31
0
votes
3 answers

react-native-image-picker installation breaks my app

Step 1: npm install react-native-image-picker ......app is still building fine..... Step 2: react-native link react-native-image picker ...app no longer compiles When I clean gradle I get error: "Could not set process working directory to…
james murphy
  • 1,505
  • 5
  • 31
  • 57
0
votes
1 answer

How to upload local device image using Axios to S3 bucket

I need to upload an image directly to an S3 bucket. I am using react native, and react-native-image-picker to select a photo. This returns a local image uri. Here is my code right now. ImagePicker.showImagePicker(options, response => { var…