4

我在 0.50 时使用过 react-native 现在我再次使用它,它是 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 我该怎么办?请帮忙。

4

2 回答 2

1

我跑了

npm ls react-native-webview

并显示:

├─┬ react-native-webview-leaflet@5.0.2
│ └── react-native-webview@8.2.1
└── react-native-webview@11.0.2

两个网页视图。

我解决了:

yarn add react-native-webview-leaflet

也就是说,我不得不重新安装“react-native-webview-leaflet”的概率,因为“react-native-webview”的更新。

于 2020-12-17T13:37:02.537 回答
0

尝试做find . -name react-native-{name-of-the-package}并寻找重复项。它们可能每次都被检测到并加载(按use_native_modules),这会导致此错误。尝试调整您的依赖项(并寻找部门的部门)以避免这种重复。最后,您的调整应该在您的锁定文件中可见。

于 2020-05-08T12:31:36.480 回答