当我使用 react-native run-ios 或只为 iOS 构建时,我收到此错误消息:
ReactComponentTreeHook.purgeUnmountedComponents is not a function. (In 'ReactComponentTreeHook.purgeUnountedComponents()', 'ReacComponentTreeHook.purgeUnmountedComponents' is undefined)
我用过CRNA并弹出。我也用过react-native-push-notification和 react-native-beacons-manager并遵循了两者的指示。当我在 Android 中运行该项目时,该项目有效。
我已阅读 here这取决于我使用的是缩小版的 react 和未缩小版的 react-dom 但我看不到我可以在哪里更改它 react native 。
我该如何解决?
最佳答案
最后,我发现我安装的 react 和 react-native 包的版本不“匹配”。我看到消息 npm WARN react-native@0.48.4 requires a peer of react@16.0.0-alpha.12 but none was installed.(我安装了以前的版本,因为另一个警告我明白了)。
我安装了 react@16.0.0-alpha.12 之后,问题就解决了。显然 facebook 已经从代码中删除了函数 ReactComponentTreeHook.purgeUnmountedComponents,它不再被使用。
关于javascript - React Native - ReactComponentTreeHook.purgeUnmountedComponents 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47351920/