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 can I format the structure of my formData object to match what the backend expects?

I am using formData to POST an image I uploaded via ImagePicker. I am sending the parameters like so: let formData = new FormData(); formData.append('image', { uri: localUri, name: filename, type }); formData.append('description', 'this is…
0
votes
1 answer

React Native - How to store captured images other folder instead of Pictures folder

I have created a simple app which captured the image and upload to the AWSs3. I want to store those image in my app folder. (I have created this once my app installed). I want to store captured images to that folder instead of the Pictures folder. I…
Vidya Kabber
  • 171
  • 1
  • 16
0
votes
1 answer

dynamic image cropping in react-native using React-Native-perspective-image-cropper

I am trying to make dynamic image cropper. I came across this package which seems to be working absolutely as I want. I am trying to add this in my application. I followed the steps as specified in document install…
0
votes
0 answers

How do I hash and un-hash the image in react native

I have created an app which captures images and upload to AWS s3. Currently, those are storing in the gallery. I want to hash/encrypt those images once I captured those and before uploading, I want to un-hash /decrypt those. How can I implement…
Vidya Kabber
  • 171
  • 1
  • 16
0
votes
1 answer

Android: react-native-image-picker manifest.xml invalid file path

Sorry if i don't fully respect the question pattern, it is my first question on StackOverflow. :) I am trying to run my react native app on Android (for the first time) after a long period of code (I was only testing on iOS). I have been fixing a…
Panda-Toine
  • 121
  • 1
  • 5
0
votes
1 answer

How do I make the content of gallery including video and Image files scrollable in react native?

I have few audio, image and video files present in the gallery. But it is not scrollable. Is there any additional controllers which I should use to make it scrollable? How can i achieve it? I'm using the react-native-gallery module.
0
votes
2 answers

How to Upload Image form Phone to Firebase Storage?

I'm trying to upload a Picture form my Phone to Firebase using Expo. I get a uri form the Picture but not sure how to convert it, that I can uploade it to Firebase? _pickImage = async () => { let result = await…
0
votes
2 answers

Image preview in react-native

I have an image uploader in my react-native app, once you upload the image it navigates you to another screen and previews the image there, in the image preview screen there is an input for giving a name for this image and a save button, when…
0
votes
1 answer

How can I change image sort order in react-native-image-crop-picker?

First of all, I just wanna say I'm newbie in native interface. For now, I'm testing react-native-image-crop-picker in iOS platform and made some example. When I open ImagePicker in example, latest image is shown bottom and oldest is top. This sort…
ian park
  • 122
  • 1
  • 8
0
votes
0 answers

React-native-image-picker (customButtons)

I'd like to change the customButtons text color, anyone knows how to do it? var options = { title: 'Select Avatar', customButtons: [ {name: 'fb', title: 'Choose Photo from Facebook'}, ], storageOptions: { skipBackup: true, …
Gustavo Menezes
  • 141
  • 3
  • 16
0
votes
1 answer

Display uploaded image in another component

I have a code that picks an image from the gallery, i want after selecting an image to navigate to another component to display the selected image there, it's working fine until i navigate to the other component it's not displaying the selected…
Judy M.
  • 243
  • 1
  • 4
  • 12
0
votes
1 answer

Upload image in expo ImagePicker without aws amplify

I am using aws-sdk can I upload images without using aws amplify I'm using expo's ImagePicker module to select the image how can I put selected image from local file path to s3.
Asnad Atta
  • 3,855
  • 1
  • 32
  • 49
0
votes
1 answer

Typescript generic Promise with React-Native Image Picker

I am learning react-nativv v0.56 and the react community's react-native-image-picker (this). I am trying to implement he image picker on iOS using TypeScript. A followed all the install instruction, and got an error. Now I am trying to implement it…
Wasyster
  • 2,279
  • 4
  • 26
  • 58
0
votes
1 answer

Xcode build fails after installing package. Uninstalling package doesn't fix it. How to recover?

After an unsuccessful install of react-native-image-picker, I am getting build errors in Xcode like... 'React/RCTEventDispatcher.h' file not found 'React/RCTBridgeModule.h' file not found What's my best route to restoring the project (e.g., getting…
arnoldbird
  • 886
  • 1
  • 13
  • 30
0
votes
1 answer

How to upload images from react naitve to mysql database?

I am new to React-Native and I'm currently working on a project where the user can upload multiple images to database. I am using react-native-image-picker library to select images from the device memory. However, I don't know how to use the…
1 2 3
20
21