1
在我的应用程序中,我希望能够从图库或相机中上传图片,并能够上传并设置图片视图。就像 Facebook的功能,什么应用程序等图片上传和裁剪的React-Native库(支持android和ios)
建议我一个正确的方法来做到这一点,一个好的图书馆(一个最常用的图书馆)可能会有所帮助。
在我的应用程序中,我希望能够从图库或相机中上传图片,并能够上传并设置图片视图。就像 Facebook的功能,什么应用程序等图片上传和裁剪的React-Native库(支持android和ios)
建议我一个正确的方法来做到这一点,一个好的图书馆(一个最常用的图书馆)可能会有所帮助。
这些都是现在很多东西还在,这里是图像库从GALLARY和相机选择,
https://github.com/react-community/react-native-image-picker
,这里是用获取上传图像的代码。
var photo = {
uri: user.profilePicture,
type: 'image/jpeg',
name: 'photo.jpg',
};
var form = new FormData();
form.append("ProfilePicture", photo);
fetch(
Constants.API_USER + 'me/profilePicture',
{
body: form,
method: "PUT",
headers: {
'Content-Type': 'multipart/form-data',
'Authorization': 'Bearer ' + user.token
}
}
).then((response) => response.json())
.catch((error) => {
alert("ERROR " + error)
})
.then((responseData) => {
alert("Succes "+ responseData)
}).done();
作物特征呢? –
试试这个库。 https://github.com/ivpusic/react-native-image-crop-picker –
harshal你可以给我一些你可能已经实现这个库的项目的参考代码吗? –