React native 如何从照相机中选择和上载多个图像

React native 如何从照相机中选择和上载多个图像,react-native,React Native,在这里,我得到的回应只有一张图片 select multiple images from camera not working **** working for single image capture and selection ***** imageCamera(){ this.setState({imageSourceText:'Camera'}) let imagearray ={} ImagePicker.openCamera({com

在这里,我得到的回应只有一张图片

select multiple images from camera not working 

****  working for single image capture and selection  *****



imageCamera(){
      this.setState({imageSourceText:'Camera'})
      let imagearray ={}
      ImagePicker.openCamera({compressImageMaxWidth:400,
        compressImageMaxHeight:400,multiple: true
        }).then(image => { . 

阅读另一个组件的文档,假设它做了您想要的,并且与您正在使用的类似


我认为你不能使用
openCamera
拍摄多张照片。它只适用于一张照片。一种解决方案是手动打开相机,根据需要拍摄尽可能多的照片,在关闭相机时使用
openPicker
并从中选择多张照片:

      this.setState({ImageSource:image})
      console.log("cameraimagearray======="+this.state.ImageSource)

        imagearray = {uri:image.path}
        let tempArray = []
        tempArray.push(imagearray)

        console.log("tempArray from Camera ============="+tempArray);
        this.setState({ImageSourceviewarray:tempArray})

        console.log("image from Camera ============="+image.path);
        }

      );
     }

如何让用户选择“照相机或画廊”?@OliverD您可以显示一个带有两个选项的自定义对话框,“照相机或画廊”。
ImagePicker.openPicker({
  multiple: true
}).then(images => {
  console.log(images);
});