Null 不是使用 Expo 的对象(评估“RNFetchBlob.DocumentDir") [英] Null is not an object (evaluating 'RNFetchBlob.DocumentDir') using Expo

查看:21
本文介绍了Null 不是使用 Expo 的对象(评估“RNFetchBlob.DocumentDir")的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Expo 并尝试使用 react-native-fetch-blob 下载文件

从'rn-fetch-blob'导入RNFetchBlob;RNFetchBlob.fetch('GET', 'http://www.example.com/images/img1.png').then((res) => {让状态 = res.info().status;}).catch((errorMessage, statusCode) => {})

发生错误:null 不是对象(正在评估'RNFetchBlob.DocumentDir')

我已经尝试过的:

npm install --save react-native-fetch-blob反应原生链接

npm install --save react-native-fetch-blobreact-native 链接 react-native-fetch-blob

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

RNFB_ANDROID_PERMISSIONS=true react-native 链接

我不能手动链接,因为我使用 expo 并且没有/ios 和/android 文件夹.

谁能帮忙,如何解决这个问题?rn-fetch-blob 是否与 Expo 合作?

解决方案

rn-fetch-blob 不适用于 expo.

<块引用>

rn-fetch-blob 实现的是原生代码,所以不能在 expo 中使用基于项目.你需要退出世博会

rn-fetch-blob 是否适用于 Expo?p>

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

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

RNFB_ANDROID_PERMISSIONS=true react-native link

I cannot do manually linking, because i use expo and do not have /ios and /android folders.

Could anyone help, how to fix this issue? Is rn-fetch-blob work with Expo?

解决方案

rn-fetch-blob doesn't work with expo.

rn-fetch-blob implements native code, and so it cannot be used in expo based projects. You would need to eject from expo

Does rn-fetch-blob work with Expo?

这篇关于Null 不是使用 Expo 的对象(评估“RNFetchBlob.DocumentDir")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆