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

React Native image picker crash after selecting (TypeError: undefined is not an object (evaluating 'l.reference.file')

I am facing a perplexing issue with the React Native image picker in my application (IOS only). When running the app on the debug scheme, everything works flawlessly. However, upon switching to the release scheme and selecting an image using the…
0
votes
0 answers

Possible Unhandled Promise Rejection in react-native-image-picker

I am trying to implement image uploading in a flash cards app but I keep getting this error: Possible Unhandled Promise Rejection (id: 8): TypeError: Cannot read property 'launchImageLibrary' of nullTypeError: Cannot read property…
0
votes
0 answers

Image Source Null on react native already give the uri

Hello Everyone i have problems when changing picture on react native that won't change the images here is my code on this code the function for add photo const addPhoto = () => {ImagePicker.launchImageLibrary({ quality:0.5, …
0
votes
0 answers

Hide react-native-image-picker device camera's back button

I'm using launchCamera() from react-native-image-picker. When the user launches the camera and then clicks the back button the app closes. I guess this is the device camera's back button. I'd like to understand why this is happening and if there is…
brenobarreto
  • 195
  • 1
  • 11
0
votes
0 answers

No package name found in android manifest

Failed to build the app: No package name found. /Users/runner/work/1/s/node_modules/react-native-image-picker/android/src/main/AndroidManifest.xml The package name is missing in AndroidManifest file after npm/pod install to solve this issue, I have…
0
votes
0 answers

React-native-image-picker issue with video on android 13, launch camera returns {"didCancel": true}

When the launchCamera function is called in the app to record a video, launchCamera function returns {"didCancel": true}. const pickedFiles = await launchCamera({ mediaType: 'video', quality: 0.8, cameraType: 'back', …
0
votes
1 answer

Undefined Values Returning from Expo Image Picker

I am trying to use expo-image-picker library to get access to the gallery and choose an image from the gallery and display it on the screen. But when I choose a picture, I console.log the result and it turns out that everything in the result is…
0
votes
0 answers

Is there a way to limit image selection in React Native for iOS to 1:1 ratio squares only?

I am currently building a react native project for iOS, and I am looking to having an image upload similar to what instagram used to have - only squares allowed. I am struggling to get there just from this. I have been using expo-image-picker's…
0
votes
0 answers

Is there a way to pick RAW images using react-native-image-picker

I have an app which lets the user upload media (image/video). The problem I'm facing is that when I try to select an image which has a format of RAW/Apple ProRAW (you can click RAW photos on iPhone 12 Pro and later Pro models with iOS 14.3 or…
0
votes
0 answers

Image Picker in React native via expo in Android 6 is not working

Im newbie to this tech, react native(android) and I cant find solution to my problem. My problem is, every time I pick an image my app will crash( this will happen if I use my samsung J7 prime, Android 6) But when I try my app to my Iphone 6s(IOS…
helloSir
  • 5
  • 2
0
votes
0 answers

How do I use react-native-image-picker for react-native-web?

I have used react-native-image-picker for both launchCamera and launchImageLibrary for react-native mobile app, but when I tried to copy the codebase for react-native-web, it shows the error "Module parse failed: Unexpected character '�' (1:0) You…
0
votes
0 answers

React Native Image Picker to open gallery and give the option to click a picture

I want to ask if their's any way to open the gallery with an option to open camera to click a picture as well. I've searched alot but couldn't find a way. Secondly i want to open the above gallery in the same screen not in another one. Thanks I've…
0
votes
1 answer

react-native-image-picker does not ask for permisison

I have just tried the official example in my real phone. https://github.com/react-native-image-picker/react-native-image-picker/tree/main/example However, When I click "Select Image", it does not ask for any permission to gallery. It directly opens.…
funky-nd
  • 637
  • 1
  • 9
  • 25
0
votes
0 answers

Expo Image Picker with AsyncStorage

If I try to save a profile picture in React Native to AsyncStorage, and I want it to be unique (different user with different profile image) the picture with camera (expo-camera) - works properly with the following context. But when I try to use…
0
votes
0 answers

Possible Unhandled Promise Rejection (id: 3):

I am developing a project through which a user can upload media files to Amazon AWS S3 storage and can manipulate it later. But it giving me a warning 'Possible Unhandled Promise Rejection (id: 3):' and my code is not working properly. Image picker…