[英]How to install react-navigation in an ejected expo project?
我正在尝试按照此页面上的官方安装说明在我弹出的 expo 应用程序中安装react-navigation
。 在下面的说明中,典型的包添加和通过react-native link
有额外的代码要添加到文件MainActivity.java
。
现在我的问题是,在安装指令中, MainActivity
类扩展了ReactActivity
类,但是由于我在代码中使用了一个弹出的 expo 应用程序,它扩展了类DetachActivity
,这似乎与安装指令的给定代码不兼容,因此我我真的不知道如何解决这个不兼容问题(特别是因为我什至无法通过谷歌找到任何关于它的东西 - 它甚至是一个没有人谈论的黑暗秘密吗?)。
我尝试过但没有奏效的一些方法:
error: method does not override or implement a method from a supertype
。DetachActivity
与ReactActivity
和删除重写的方法,所有方法DetachActivity
导致应用程序死机。Native module com.swmansion.gesturehandler.react.RNGestureHandlerModule tried to override versioned.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerModule for module name RNGestureHandlerModule. Check the getPackages() method in MainApplication.java, it might be that module is being created twice. If this was your intention, set canOverrideExistingModule=true
Native module com.swmansion.gesturehandler.react.RNGestureHandlerModule tried to override versioned.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerModule for module name RNGestureHandlerModule. Check the getPackages() method in MainApplication.java, it might be that module is being created twice. If this was your intention, set canOverrideExistingModule=true
Native module com.swmansion.gesturehandler.react.RNGestureHandlerModule tried to override versioned.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerModule for module name RNGestureHandlerModule. Check the getPackages() method in MainApplication.java, it might be that module is being created twice. If this was your intention, set canOverrideExistingModule=true
。我真的很感激一些明智的提示! 另外,我对java不是很熟悉,但我非常愿意学习一些新东西!
下面无视。 现在,Expo 正在将它们的内置依赖项分离为 react-native-gesture-handler。 所以我们需要安装它。 参考
总结一下,
回到你从博览会中弹出一个项目的提交。 并安装react-navigation
。 不要将其他人安装为react-native-gesture-handler
。
就这样。
如果你从 expo 中弹出你的项目,这些项目将依赖于 ExpoKit,所以不需要再次安装已经构建的模块。 而react-native-gesture-handler
就是这些模块之一。 因此,也不需要react-native link
。
Native module com.swmansion.gesturehandler.react.RNGestureHandlerModule tried to override versioned.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerModule for module name RNGestureHandlerModule. Check the getPackages() method in MainApplication.java, it might be that module is being created twice. If this was your intention, set canOverrideExistingModule=true.
并且此消息可能是由您再次安装的RNGestureHandlerModule
引起的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.