Rn-fetch-blob: null is not an object (evaluating 'RNFetchBlob.DocumentDir') using Expo

Created on 11 Jan 2020  路  2Comments  路  Source: joltup/rn-fetch-blob

I'm using Expo and try to download files using react-native-fetch-blob

import RNFetchBlob from 'rn-fetch-blob';

RNFetchBlob.fetch('GET', 'http://www.example.com/images/img1.png')
  .then((res) => {
    let status = res.info().status;
  })
  .catch((errorMessage, statusCode) => {
  })

There is an error occurs: null is not an object (evaluating 'RNFetchBlob.DocumentDir')

What i've already tried:

npm install --save react-native-fetch-blob
react-native link 
npm install --save react-native-fetch-blob
react-native link react-native-fetch-blob



md5-81b3b8e712695f57b8b07e27a9bae32e



var RNFetchBlob = require('rn-fetch-blob').default



md5-81b3b8e712695f57b8b07e27a9bae32e



RNFB_ANDROID_PERMISSIONS=true react-native link

How to fix this issue? Does rn-fetch-blob work with Expo?

All 2 comments

You cannot use RNFetchBlob in an Expo managed project as it requires deep linking. Try using expo-file-system instead.

Was this page helpful?
0 / 5 - 0 ratings