Require cycle: node_modules/rn-fetch-blob/index.js -> node_modules/rn-fetch-blob/polyfill/index.js -> node_modules/rn-fetch-blob/polyfill/Fetch.js -> node_modules/rn-fetch-blob/index.js
// import RNFetchBlob from 'rn-fetch-blob';
import { NativeModules } from 'react-native';
// const path = RNFetchBlob.fs.dirs.DownloadDir;
const RNFetchBlob = NativeModules.RNFetchBlob;
const path = RNFetchBlob.DownloadDir;
구글링해보다가 NativeModules
를 사용하니까 Warning은 사라졌는데 DownloadDir 코드에서 에러가 발생해서 원인을 찾느라 해결하는데 오래걸렸다.
알고보니 새로 import 해준 NativeModules
의 RNFetchBlob
에는 fs
가 없어서 발생한 에러였다. 바로 DownloadDir
을 사용해주면 된다.
Reference
👉 https://github.com/joltup/rn-fetch-blob/issues/183