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

react native image picker error : undefined is not an object

I implemented get photo from library, but when I don't choose photo in libary and just cancel, I got error undefined is not an object (evaluating 'response.assets[0]') I think it's because response.assets[0].uri might be empty when I didn't choose…
김소흥
  • 11
  • 2
0
votes
0 answers

Is it possible to use picture taken from camera in expo go app, without gallery permissions?

I'm using expo-image-picker. I want to use images taken from the camera when only camera permission is granted and gallery permission is denied. I don't need the image to be saved in the phone's gallery. Right now I'm getting this error User…
0
votes
2 answers

Video Camera with custom text

I am new to react-native. Now, I would like to show the text while recording. For example, if I open the camera then show the text 1234 until I finished the recording. Can anyone please help to develop this UI? I am really worried about fixing this…
0
votes
2 answers

launchCamera() in react-native-image-picker doesn't open anything when installed on a device

amazing developers. I am building an app that would offer opportunity to either take a photo on spot and upload it, or choose an image from gallery. I am using react-native-image-picker for it. So far, my life was going great and everything ran…
0
votes
1 answer

Why i get gradle build error when adding image_picker into my dependecies?

I just simply add image_picker: to my dependecies and after i do pub upgrade i can't build the project. I get this error message: FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project…
0
votes
1 answer

Save image selected from ImagePicker to MongoDB

I am creating a mobile app using React Native and I want to have the ability for the user to change their profile picture. I am using an ImagePicker for the user to select their image. What I am having trouble with is how do I use the response from…
marcelomo
  • 161
  • 2
  • 14
0
votes
1 answer

React native image picker not displaying selected image

I don't seem to be able to render the image selected when using react-native-image-picker. After selecting an image from the device library the default image stays selected My first thoughts are it has something to do with the path defaultImageUri…
Richlewis
  • 15,070
  • 37
  • 122
  • 283
0
votes
0 answers

React Native can't upload image to API (Problem with Content-Type & The File Field is required). 2d stuck on it :(

I've try some solution on stackoverflow about this problem but there is no way out. This is my error on debugger : RED = Image File Details | BLUE = Error Im using react-native-image-picker and axios on this case. There is my code on sign up (to…
0
votes
1 answer

Django is receiving image into a React Native FormData instance as an dict

I have a React Native app, there is a screen to upload a logo (an image). When the logo gets uploaded, Django should receive the image, save into an user row and create the file into local assets folder (as usual). The problem is, i don't even know…
0
votes
0 answers

How to filter out already selected image from images shown by `expo-image-picker`

I'm using expo-image-picker to select images from different folders. I works fine, but I want to filter out images that are already selected, in case user re-open the image picker to pick another image. In short I don't want user to pick same image…
Israr Khan
  • 21
  • 4
0
votes
1 answer

react-native-image-crop-picker not displaying image

My Image Picker is able to select image from the gallery but it is unable to display the image on the app, I've tried many ways and reviewed my code all over again but I'm unsure what went wrong. Can anyone tell me what's the problem? Here is my…
0
votes
0 answers

How to fix this "Couldn’t get file path for photo" while trying to open camera with react-native-image-picker?

I am using react-native-image-picker for capturing and storing the image to some location. In some devices the error: Couldn’t get file path for photo is coming even if android:requestLegacyExternalStorage="true" was already mentioned in the…
0
votes
0 answers

Error in uploading image with 'react-native-image-picker' library

I am creating an android application and I need to use the react-native-image-picker library but it is showing some error, the error is: [Unhandled promise rejection: TypeError: null is not an object (evaluating…
yogesh kumar
  • 103
  • 10
0
votes
1 answer

React-Native-Image-Picker Auto video recording possible?

I'm a beginner at React Native. I am trying to access a native(built-in) camera app on Android device. I used React-Native-Image-Picker to open the camera app but I would like to record a video somehow automatically(?) I mean not using my finger. I…
seol hyeon
  • 31
  • 2
0
votes
1 answer

video Duration Limit is not working in iOS 14 and image editing also not working in react native

Plugin Url this below code doesn't allow durationLimit filter. Image Picker version: 4.6.0 React Native version: 0.66.3 Platform: iOS Development Operating System: MacOS Dev tools: Xcode, iOS mediaType: 'video', videoQuality:…
Avruti
  • 67
  • 1
  • 8