react-native - React Native 导入 React Navigation
问题描述
我遵循安装适用于 Android 的 React Navigation 的所有说明。
首先,“npm install --save react-navigation”、“npm install --save react-native-gesture-handler”。“react-native link react-native-gesture-handler”,最后更新了我的MainActivity.java
这是我的MainActivity.java
:
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "InstagramClone";
}
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
@Override
protected ReactRootView createRootView() {
return new RNGestureHandlerEnabledRootView(MainActivity.this)
}
};
}
}
这是我得到的错误:
- 出了什么问题:创建目录 'D:\React Native Projects\InstagramClone\node_modules\react- 时无法创建父目录 'D:\React Native Projects\InstagramClone\node_modules\react-native-gesture-handler\android\build'本机手势处理程序\android\build\intermediates\check-manifest\debug'
解决方案
如果您使用expo
install启动了您的项目react-native-gesture-handler
。但是,如果您的计划由您开始,react-native cli
您必须先安装react-native-gesture-handler
,然后通过以下命令将其链接到所有包:
react-native link
推荐阅读
- linux - Linux Bash 脚本中的“if”语句中的“[: too many arguments”错误
- node.js - util.inspect() 结果在一行
- c# - 如何使用 Microsoft Translator API GetTranslations 获得替代翻译
- python - Elasticsearch-dsl 嵌套查询
- codenameone - 如何让地图在特定位置打开?
- angular - 角路由器链接不起作用
- php - 用 2 个表查询 eloquent
- jquery - 如果键入的最后 2 个字符是 /c 则执行此 jquery
- react-redux - 正则表达式大小写敏感性不适用于 Redux-Forms
- java - 检查用户是否来自意图