【发布时间】:2018-06-30 15:48:41
【问题描述】:
我在这里的文档中读到:https://github.com/mg365/react-native-customized-image-picker 我可以从图像中获取数据的响应对象,但是当我尝试它时,我得到了undefined。我可以像这样获取其他对象,例如大小、mime 和路径:
SelectPhoto = () =>{
ImagePicker.openPicker({
cropping: true,
title: 'Select a Picture',
isCamera: true,
}).then((imgResponse) => {
console.log(imgResponse[0].path); <-- This logs the correct path
console.log(imgResponse[0].data); <-- This logs the undefined
let imgSource = { uri: imgResponse[0].path };
this.setState({
userimgSource: imgSource,
});
});
}
我的最终目标是将图像上传到服务器,我认为需要数据?我正在使用 RNFetchBlob 多部分/表单数据。感谢您对此的任何帮助,谢谢!
【问题讨论】:
标签: reactjs object react-native image-uploading react-native-fetch-blob