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
3
votes
1 answer

Expo-Image-Picker in React Native

Is there a way to limit video recording time using ImagePicker.launchCameraAsync()? My code: captureVideoObject = async () => { return await ImagePicker.launchCameraAsync({ mediaTypes: ImagePicker.MediaTypeOptions.Videos, …
3
votes
2 answers

react-native-image-picker crashing at run - Metro Bundler error

I want to use 'react-native-image-picker' in my application. After importing and following the install instructions from the github instructions. I get a metro bundler crash on run. It can't seem to locate the 'react-image-picker' or it's…
3
votes
5 answers

How to send an image message only ? (without sending a text as well)

I simply want to send an image without typing any text ? I am using react-native-image-picker and i currently can send an image with a text , but what if i want to send an image only ? I tried alwaysShowSend and try to send but nothing happens…
3
votes
2 answers

Getting "Illegal callback invocation from native module. This callback type only permits a single invocation from native code"

I am using react-native-image picker and react-native-image-crop picker libraries in two class. One is launching the library image (react-native-image picker) and other one package opens the cropping window(react-native-image-crop-picker). Here the…
3
votes
2 answers

IOS React Native ImagePickerManager is null

I'm trying to use the package react-native-image-picker with IOS emulator. ... import ImagePicker from 'react-native-image-picker'; ... constructor(props) { super(props); this.state = { avatarSource: null, }; …
myTest532 myTest532
  • 2,091
  • 3
  • 35
  • 78
3
votes
2 answers

react-native-image-picker - persistent storage after rebuild

I've been hitting my head on the screen for some time and just can't get it to work despite all the information I've found on git or stackoverflow. What I'm trying to achieve: Persistence of the images selected (from library or camera). Persistence…
Jojo
  • 133
  • 3
  • 9
3
votes
3 answers

React Native Image Picker not configures

I'm trying to install react-native-image-picker to my React-native project, I have configured as the documentation suggests; As the example suggests; I tried reinstall Android Studio (3.1 and 3.2); I download all APIs and All Tools; Nothing solves…
alvesoaj
  • 512
  • 5
  • 16
3
votes
1 answer

Cannot read property 'openPicker' of undefined

I have installed library using pod file. used this library https://github.com/ivpusic/react-native-image-crop-picker image selection from gallery working fine when I run code from x-code , but got above error when I run 'react-native run-ios'. Any…
2
votes
0 answers

Can't upload image using react-native, GraphQL and urql

So I'm trying to send an image to our server with react native using GraphQL query and I don't know why but it always return an error : [CombinedError: [Network] Network request failed]. The query : import { graphql } from '../../gql'; import { gql,…
2
votes
2 answers

Expo-Image-Picker does not work on android

I use Expo SDK47(the latest). I can choose a photo but it returns me an object with undefined properties (I added the result below). It works on ios but not Android devices ( Samsung and Huawei). My code is like that. I followed the documentation. …
KaganBerk
  • 88
  • 1
  • 1
  • 11
2
votes
1 answer

'react-native-image-picker' allowing to choose images even after the Photo Library permission is declined

When "Photo Library" permission prompted & declined. Still able to open library & choose images in iOS. tested on iOS version: 15.5 dependencies used: "react-native-image-picker": "^4.8.3" Here is my code. import { launchImageLibrary } from…
2
votes
2 answers

React Native form data request failed with no multipart boundary was found

I'm struggled with react native file upload using Axios form data. I set the content type as multipart/form-data. below is my request parts. form-data body…
2
votes
1 answer

undefined is not an object (evaluating '_ExponentImagePicker.default.requestMediaLibraryPermissionsAsync') in expo-image-picker

Error from catch error block Image Hi, I am using expo-image-picker and I stumbled with this error for a while now. and this is all the necessary code that I use. I'll give a green checkmark for appreciation. For more information, I have already…
2
votes
1 answer

Uploading a video from the android gallery to Firebase Storage with react-native

I am currently working on a react-native project where the user can upload a video from his app to firebase storage. The user can either select a video from his library or take a new one directly in the app. I use the react-native-image-picker…
2
votes
0 answers

Save image locally using react-native-image-picker

I am new to React Native. I am trying to get images from react-native-image-picker library and I am trying to get the file path and store it in the redux store to access it later. Rather I am getting a cached file path so I am unable to get the…
1 2
3
20 21