React Native Fetch Blob - undefined不是对象(评估'RNFetchBlob.DocumentDir') [英] React Native Fetch Blob - undefined is not an object (evaluating 'RNFetchBlob.DocumentDir')

查看:1558
本文介绍了React Native Fetch Blob - undefined不是对象(评估'RNFetchBlob.DocumentDir')的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已经查看了wiki的故障排除页面,但是我仍然无法解决我遇到的问题。

I have looked at the trouble shooting page of the wiki, however I still cannot fix the problem I am having.

react-native-cli: 2.0.1
react-native: 0.43.4



我的代码:



从'react-native-file-uploader'导入FileUploader

<Button
    onPress={() => RNFetchBlob.fetch('POST', 'http://localhost:8000/upload', {
            'Content-Type' : 'application/octet-stream'
        }, RNFetchBlob.wrap('./tempImageStore/image.jpg'))
    }
    title={'Upload File'}
/>



我收到错误:



< img src =https://cloud.githubusercontent.com/assets/13806068/25783660/f1ae39dc-3314-11e7-9ad8-487b0105bbbd.pngalt =模拟器屏幕截图可能2017年7月11日上午04时09分>

Error I am getting:

1) npm install --save github:wkh237 / react-native-fetch-blob-package#master

2) react-native link


  • 我尝试用'react-native-fetch-blob'和 var RNFetchBlob = require('react'来导入RNFetchBlob -native-fetch-blob')。默认

  • 我尝试使用上面的代码安装它,还使用 npm install - save react-native-fetch-blob

  • 我在 IOS 模拟器上尝试此操作。

  • I have tried importing it with both import RNFetchBlob from 'react-native-fetch-blob' and var RNFetchBlob = require('react-native-fetch-blob').default
  • I have tried installing it with the above code and also with npm install --save react-native-fetch-blob
  • I am trying this on the IOS emulator.

提前感谢您的帮助!

推荐答案

所以看起来模块没有导入。显而易见,我知道,我只能想到一些有待观察的事情,因为该项目看起来相当受欢迎且稳定。

So it looks like the module isn't importing. Obvious I know, I can only think of a few things to help seeing as that project looks fairly popular and stable.

我注意到你需要'react-native-file-uploader'但是使用'react-native-fetch-blob'。我认为这是一个错误。你也可以尝试,如果你还没有:

I noticed that you're requiring 'react-native-file-uploader' but using 'react-native-fetch-blob'. I'm assuming this is a mistake. You could also try, if you haven't:

var RNFetchBlob = require('react-native-fetch-blob')

现在假设您正确导入它,请尝试以下操作之一,然后重新启动x-code:

Now assuming you're correctly importing it, try one of the following and then restart x-code:


  1. 如果您还没有重新启动打包器。我记得每次安装新模块时都必须重新启动打包器。

  1. If you haven't already restart the packager. I recall having to restart the packager every time I installed a new module.

如果这不起作用,请尝试安装从节点模块中删除它(只是为了安全起见)并安装可可豆荚,它们将为您处理所有链接。

If that doesn't work, try installing deleting it from your node modules (just to be safe) and installing with cocoa pods which will handle all of the linking for you.

这篇关于React Native Fetch Blob - undefined不是对象(评估'RNFetchBlob.DocumentDir')的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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