I was trying to use react-native-fetch-blob in my project, but whenever I put an
import RNFetchBlob from 'react-native-fetch-blob'
and I get an error on the emulator as
Cannot read property 'Document Dir' of undefined
I have installed it using
npm i --save react-native-fetch-blob
and linked it using
react-native link
Error :
Cannot read property 'DocumentDir' of undefined fs.js:24:31 loadModuleImplementation require.js:214:4 guardedLoadModule require.js:148:11 _require require.js:132:2 index.js:21 loadModuleImplementation require.js:214:4 guardedLoadModule require.js:148:11 _require require.js:132:2 App.js:6 loadModuleImplementation require.js:214:4
After installing and linking the package. Do the following
watchman watch-del-all
npm cache clean --force
rm -f /ios/build
(if you are building for ios)
rm -f /android/build
(if you are building for android)
react-native run-ios `or` react-native run-ios
Hope it solves your problem