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
1
vote
1 answer

text must be rendered within when using image-picker

I am trying to implement an image uploader into my app. Nonetheless, I keep getting the following error: Text strings must be rendered within a component. All other files are working properly as they remain independent from this part of the…
1
vote
0 answers

How to correctly force resize in IOS using Expo ImagePicker

I'm developing an app in React Native using the Expo framework. In the app users can take images and they have to be resized by the user itself (note: resizing it later programmatically is not possible because I might cut off important…
Gavin Hartog
  • 31
  • 1
  • 5
1
vote
0 answers

in target 'react-native-image-picker' from project 'Pods'

after running this command npx react-native run-ios I got the following error objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'react-native-image-picker' from project 'Pods') The following build commands failed: CompileC…
1
vote
0 answers

react-native-image-picker null launchImageLibrary

I'm new to react-native and trying to build an app to upload photos. The following use of react-native-image-picker `launchImageLibrary does not work when running in ios simulator. I get a Cannot read property "launchImageLibrary" of null error. It…
Fabian
  • 3,310
  • 3
  • 26
  • 35
1
vote
0 answers

Error when trying to record a video using react-native-image-picker

I have been using react-native-image-picker for upload a certain recorded video and hence used the launchCamera method to open the camera to record a video in real time. However I am getting an error in IOS (this works fine in Android) as…
SHA
  • 81
  • 6
1
vote
1 answer

The image doesnt show in the flatlist what am I missing here?

I made an app in React Native where you can add a "player" and his/her "position" to a flatlist and after that, the user should be able to make a picture and it is supposed to show it in the flatlist along with the name and position. The problem is…
1
vote
1 answer

What is the format of filesize returned by react-native-image-picker in response.filesize. Is it in bytes or bits?

What is the format of filesize returned by react-native-image-picker in response.filesize. Is it in bytes or bits? Check the below code: try{ let options = { mediaType: 'photo', maxWidth: 1280, maxHeight: 720, quality: .5, …
1
vote
0 answers

limited access privilege always return all the photos using expo-image-picker

I'm new w/ React Native and ask you for the help. I'm building an app for iOS which can use camera and photo library. Everything is good, except limited accessPrivilege. When first time user tries to access library there are 3 options : Select…
1
vote
1 answer

Selected image update on Avatar R.N Image Picker

Hello guys I'm Using React native Image Picker I able to select image from android library but after selection Im not able to update on my Avatar profile[Image] After select Image here is my console.log responseponse = {"assets":…
1
vote
0 answers

React Native: react-native-image-picker library's launchImageLibrary function is not opening the photo library

I am building an IOS application using React Native. I am now implementing a feature for my application where user has to pick a photo from the library. I am using this library, react-native-image-picker…
1
vote
0 answers

React Native - Integration of camera and photo upload in one screen

I am trying to find a library or a way to implement the camera and upload pictures in one screen like it is on IOS or android camera. For example you open the camera app and you get to take the photo or choose from gallery. Is there a way to do…
1
vote
2 answers

How to solve Firebase Storage: Invalid URL when trying to upload and image react native

I am trying to upload an image to firebase storage, the problem is I get Firebase Storage: Invalid URL when I try to upload it. First I get the uri from the react-native-image-picker then I use it to make the reference. This is my code: export…
1
vote
0 answers

Unhandled promise rejection: Error: Unable to download file: Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" -> React Native With GL-REACT

I'm attempting to use GL-REACT-NATIVE with expo to apply filter (Default presets) to images. I could manage to make it work with a default url from the package, 'https://i.imgur.com/5EOyTDQ.jpg' although I wan't to use it on my own urls from…
Nilton Schumacher F
  • 814
  • 3
  • 13
  • 43
1
vote
1 answer

Upload video from react native to aws using aws-sdk

Note: working great with image Below is the code to select image/video await launchImageLibrary(options, response => { if (response.didCancel) { } else if (response.error) { } else if (response.customButton) { } else { let url…
1
vote
0 answers

Why expo ImagePicker is not giving me an option to trim the video before/when uploading from an android device, even after using videoMaxDuration: 30,

in IOS, we can't upload any video that is greater than 30 Seconds. and if you try to upload it would give you an option to trim it to 30 seconds like Whatsapp, but on android it is taking any video that we are uploading. Any idea what might be…