android - React 中的多张图片上传
问题描述
我正在构建一个带有本机反应的电子商务移动应用程序,我想让用户上传产品的多个图像成为可能,但我不知道要安装哪个包才能工作,我不知道甚至不知道我是否应该从头开始,这个问题更像是一个建议问题,只是为了指导我,请任何帮助都会非常棒,谢谢
解决方案
我使用react-native-image-cropper-picker并削减它。它允许multiple picking
,base64
等cropping
。
要选择多个,您可以执行以下操作:
pickMultiple() {
ImagePicker.openPicker({
multiple: true,
waitAnimationEnd: false,
includeExif: true,
forceJpg: true,
}).then(images => {
this.setState({
imagesArray: images.map(i => {
console.log('received image', i);
return {uri: i.path, width: i.width, height: i.height, mime: i.mime};
})
});
}).catch(e => alert(e));
}
推荐阅读
- powershell - Powershell设置一个变量并打印但什么也没有
- python - Python while 循环在超出范围 (0, 10) 后不会终止,但 for 循环会。这是为什么?
- javascript - Jquery分配输入值但表单提交时为空
- javascript - 在突出显示的元素上添加类?
- spring-boot - Springbook 2.0 拦截器转发到控制器
- webrtc - WebRTC 客户端会与仅支持通道而不支持数据/发送机制的 TURN 服务器一起使用吗?
- azure - ARM 模板部署的函数应用没有主机密钥并引发错误
- go - 由 go-side 服务器关闭的 gRPC 套接字
- javascript - 列表项上存在关键道具,但仍收到关键警告
- c# - Newtonsoft.Json 反序列化不会覆盖构造函数中设置的属性