shijingsh / react-native-customized-image-picker

iOS/Android image picker with support for camera, video compression, multiple images and cropping
245 stars 59 forks source link

open camera and gallery individually #31

Closed Neha1490 closed 4 years ago

Neha1490 commented 6 years ago

Hi

Is it possible to open camera and gallery individually i.e. on click of "take picture from camera" open camera and on click of "take picture from gallery" open gallery?

liukefu2050 commented 6 years ago

There is no open camera option at the moment But it also has a similar effect to setting as this for android: ImagePicker.openPicker({ isCamera:true, openCameraOnStart:true, returnAfterShot:true }) If ios you need to call openCamera

liukefu2050 commented 6 years ago

The "openCamera" option has been added. ImagePicker.openCamera({ width: 300, height: 400, cropping: true }).then(image => { console.log(image); });

SiyabongaNzulwana commented 5 years ago

Hi

Is it possible to open camera and gallery individually i.e. on click of "take picture from camera" open camera and on click of "take picture from gallery" open gallery?

@Neha1490 Yes it is, you just need to do this, ``` const options = [ { id: "take", label: "Take Photo..."}, { id: "choose", label: "Choose from Library..."}, ];

showPopupMenu(
  options,
  item => {
    switch (item.id) {
      case "take":
        this.setState({ loading: false })
        ImagePicker.openCamera({
          width: 300,
          height: 400,
          isVideo: true
        }).then(image => {
          console.log('woza: ',image);
        });

        break;
      case "choose":
        this.addMultipleItems()
        break;
    }
  },
  this.addSupportingMediaButton
);

}`` that allshowPopupMenuis fromreact-native-popup-menu-android`