得到错误的 "违反不变性"。试图用相同的名称注册两个视图。

问题描述 投票:2回答:1

我用过react-native,当时它是0.50,现在我又用它了,它是0.61.1,我正在做一个应用程序,用的是 "react-navigation" 库的路由。

由于我使用的是 react-native-gesture-handler 根据文档,我得到的错误有时为 "Invariant Violation: Tried to register two views with the same name" 而当我关闭应用程序并重新打开它时,它就不见了。

尤其是 "Invariant Violation: Tried to register two views with the same name gestureHandlerRootView" 应用中多次出现错误。

这里是 截图 的错误。

因为这个错误,我的应用程序在发布模式下 也是崩溃的,只要我打开它。我使用的是React Native CLI而不是EXPO。我在堆栈溢出和其他地方搜索过,但得到的所有答案都是说要删除 react-native-gesture-handler 从世博会。但是我没有用EXPO该怎么办?请大家帮忙。

react-native react-navigation react-native-gesture-handler
1个回答
0
投票

试着做 find . -name react-native-{name-of-the-package} 并寻找重复的内容。它们可能每次都会被检测和加载(由 use_native_modules试着调整你的依赖关系(并寻找deps的deps),以避免这种重复。最后,你的调整应该可以在你的锁文件中看到。

© www.soinside.com 2019 - 2024. All rights reserved.