Possible Unhandled Promise Rejection (id: 0): Error: Unsupported input file type
Possible Unhandled Promise Rejection (id: 0): Error: Unsupported input file type
I am using file stack in react-native to upload image and get url as response but i am getting this error.
const ChooseImage=()=>{
let options = {
title: 'Choose an image',
storageOptions: {
skipBackup: true
}
};
launchImageLibrary(options, (response) => {
if (response.didCancel) {
// on cancel
} else {
const source = { uri: response.uri };
setAvatarSource(source)
Client.upload(response).then(data =>console.log(data));
}
});
}
你只需要将图像 source
属性更改为 source = {{ uri: response.uri }}
如果你使用来自任何网络 link(或来自任何 api)的图像,请添加此项
如果您使用的是本地图片,则必须使用 source={require('some_image_path')}
I am using file stack in react-native to upload image and get url as response but i am getting this error.
const ChooseImage=()=>{
let options = {
title: 'Choose an image',
storageOptions: {
skipBackup: true
}
};
launchImageLibrary(options, (response) => {
if (response.didCancel) {
// on cancel
} else {
const source = { uri: response.uri };
setAvatarSource(source)
Client.upload(response).then(data =>console.log(data));
}
});
}
你只需要将图像 source
属性更改为 source = {{ uri: response.uri }}
如果你使用来自任何网络 link(或来自任何 api)的图像,请添加此项
如果您使用的是本地图片,则必须使用 source={require('some_image_path')}