Search code examples
react-nativefilestack

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));           
        }
      });
    } 

Solution

  • you just need to change the image source prop to source = {{ uri: response.uri }} add this if you are using the image from any web link (or from any api)

    If you are using local image then you must use source={require('some_image_path')}