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

查看:42
本文介绍了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)=> {let status = 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').默认 

  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配合使用?

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天全站免登陆