import ImagePicker from "react-native-customized-image-picker";
pickers(){
ImagePicker.openPicker({
multiple: true,
maxSize:3-this.state.imagespath.length,
spanCount:3,
includeBase64:true,
minCompressSize:400,
})
.then(images => {
// console.log('123',images);
images.map((item,index)=>{
if (item.size>300000) {
this.refs.toast.show("图片过大,建议每张图片大小约为300K");
return false;
}
return this.state.imagesformdata.push(item.data);
})
// console.log('123',images[0].data);
images.map((item,index)=>{
if (item.size>300000) {
this.refs.toast.show("图片过大,建议每张图片大小约为300K");
return false;
}
return this.state.imagespath.push(item);
})
this.setState({
imagespath:this.state.imagespath,
images:this.state.imagesformdata
})
})
.catch(err=>{
console.log(err);
this.refs.toast.show("选择图片过大,请您重新选择!");
})
}