美文网首页
React-native遇见的一些bug或者报红

React-native遇见的一些bug或者报红

作者: 一粒沙随风飘摇 | 来源:发表于2017-06-06 22:30 被阅读0次

问题1:

warning:setState(...): Cannot update during an existing state transition (such as within `render` or another component's constructor). Render methods should be a pure function of props and state; constructor side-effects are an anti-pattern, but can be moved to `componentWillMount`

参考这个进行修改:

https://stackoverflow.com/questions/39198944/react-native-redux-setstate-cannot-update-during-an-existing-state-transit

问题2:

warning:Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}),原因是fsevent是在macOS下的依赖包,当前是64位win系统,因此只报warning信息,此处是因为fsevents是适用于mac的,os是指操作系统,arch是体系结构;并没什么影响,运行时如果说是windows或者Linux,会直接跳过他的,

its not an error.its a MAC OS Specified, running onwindowsorLinuxshow this warning,this the only reason it is showing this warning, you can skip it..

问题3:

Bundling `index.android.js`  [development, non-minified, hmr disabled]  0.0% (0/1), failed.

error: bundling failed: "TransformError: D:\\AA\\fff\\index.android.js: Unexpected token ) (While processing preset: \"D:\\\\AA\\\\fff\\\\node_modules\\\\babel-preset-react-native\\\\index.js\")"

参考此处进行修改:

https://github.com/facebook/react-native/issues/15513

主要是React-native@0.47.1版本中的babel-preset-react-native@3.0.0版本的问题,所以把其换为2.1.0版本进行使用支持,

yarn remove babel-preset-react-native

yarn add babel-preset-react-native@2.1.0

相关文章

网友评论

      本文标题:React-native遇见的一些bug或者报红

      本文链接:https://www.haomeiwen.com/subject/cninfxtx.html