rn-fetch-blob icon indicating copy to clipboard operation
rn-fetch-blob copied to clipboard

RNFetchBlob doesn't execute

Open yasir-netlinks opened this issue 5 years ago • 2 comments

Hi there, I am trying to run this but it doesn't execute at all after granting permission

const isGranted = await requestWritePermission();

    if (isGranted === 'granted') {
      console.log('condition passed')
      let url = urlConfig.API_BASE_URL + uploadFileURL + `/${userId}/` + fileName;

      let myDirectory = fs.dirs.DocumentDir + `/${fileName}`
      let options = {
        fileCache: true,
        addAndroidDownloads: {
          useDownloadManager: true,
          notification: false,
          path: fs.dirs.DownloadDir,
          description: 'File downloaded'
        }
      };
      RNFetchBlob.config(options).fetch('GET', url, {
        Authorization: `Bearer ${token}`
      }).then((res) => {
        console.log('res from download: ', res.path())
      }).catch((err) => {
        console.log('err from download: ', err)
      })
    } else {
      console.log('permission not granted')
    }
  }

It did work throwing an error before I implement "request for permission", but after I implemented and granted permission, the RNFetchBlob didn't return anything, it doesn't run at all. The last log is console.log('condition passed')

yasir-netlinks avatar Dec 29 '18 15:12 yasir-netlinks