小编Vic*_*aso的帖子

React Native JSON.stringify无法序列化循环结构

我们正在构建一个RN应用程序(RN0.37),我们遇到了一个问题,当应用程序运行时,我们得到一个" TypeError: JSON.stringify cannot serialize cyclic structures".

API响应中没有任何相关性发生变化,最近问题消失了,但是在擦除/重建时(由不相关的问题触发)重新出现.

我怀疑是使用了几个包:" react-native-router-flux"和" react-native-permissions",但我无法在应用程序中找到任何相关内容.

目前我对"react-native-router-flux"的怀疑主要基于这篇文章:https://github.com/aksonov/react-native-router-flux/issues/363

我对"反应本机权限"的怀疑主要是基于这样一个事实,即在这个项目中包含这个包的时机是可疑的,并且似乎与这个错误的表现相吻合 - 尽管我无法证明绝对肯定.

我唯一的另一个线索是,JSON.stringify错误似乎总是在一个警告列表之前.他们都读到"这个合成事件是出于性能原因重复使用的.如果你看到这个,你就是在一个已发布/无效的合成事件上访问该属性.这被设置为null.如果你必须保留原始合成事件,使用event.persist()https://facebook.github.io/react/docs/events.html#event-pooling以获取更多信息." 列表如下(始终按相同顺序):nativeEvent,type,target,currentTarget,eventPhase,bubbles,cancelable,timeStamp,defaultPrevented,isTrusted和touchHistory.

以下是我的package.json:

"dependencies": {
  "blueimp-md5": "2.5.0",
  "moment": "2.16.0",
  "phone-formatter": "0.0.2",
  "react": "15.3.2",
  "react-native": "0.37.0",
  "react-native-asset-library-to-base64": "1.0.1",
  "react-native-aws3": "0.0.3",
  "react-native-button": "1.7.1",
  "react-native-cached-image": "1.2.2",
  "react-native-camera-kit": "4.0.1",
  "react-native-camera-roll-picker": "1.1.9",
  "react-native-contacts": "0.5.2",
  "react-native-fbsdk": "0.4.0",
  "react-native-fetch-blob": "0.10.0",
  "react-native-fs": "2.0.1-rc.2",
  "react-native-geocoder": "0.4.5",
  "react-native-image-crop-picker": "0.10.5",
  "react-native-image-resizer": "0.0.12",
  "react-native-nav": "1.1.4",
  "react-native-permissions": "0.2.5",
  "react-native-photo-view": "1.2.0",
  "react-native-router-flux": "3.37.0",
  "react-native-stripe": "1.2.1",
  "react-native-swipe-list-view": "0.3.1",
  "react-redux": "4.4.6", …
Run Code Online (Sandbox Code Playgroud)

json cyclic ios react-native react-native-router-flux

8
推荐指数
2
解决办法
5703
查看次数