反应本机和流错误消息 [英] react native and flow error messages
问题描述
我正在尝试与React Native进行一些交流. 我创建了项目"react-native init",更改了".flowconfig"中的流版本.
Hi I was trying to do some hello world with React Native. I created project 'react-native init' change the flow version in '.flowconfig'.
Ran流,它给了我153个错误,这些错误在node_modules
文件夹中,例如
node_modules/react-native/Libraries
Ran flow and it gave me 153 errors which are in the node_modules
folder like
node_modules/react-native/Libraries
有没有人遇到过同样的问题?
Does any one happen have this same problem?
推荐答案
我遇到了同样的问题.您需要执行两个步骤:
I ran into very same problem. You need to do two steps:
[ignore]
; We fork some components by platform
.*/*[.]android.js
; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/
; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*
; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js
.*/Libraries/react-native/ReactNative.js
<PROJECT_ROOT>/node_modules/.*
<PROJECT_ROOT>/libdefs.js
.*/__tests__/.*
[include]
[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow
./libdefs.js
2.在根文件夹中创建 libdefs.js .它应该看起来像这样:
2. create libdefs.js into root folder. It should look something like this:
declare module 'react-native' { declare var exports: any; }
declare module 'jest' { declare var exports: any; }
另外,声明所有模块流引发有关的错误(例如'mobx'-我知道这可能会令人沮丧,但这必须要做)
Plus, declare all the modules flow throws errors about (e.g. 'mobx' -- I know this can be a bit frustrating, but it has to be done)
这篇关于反应本机和流错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!