如何设置反应上Android原生的导航?

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

我有一些问题与维克斯反应本地导航当我安装了他们,我做是正确的文档中的步骤,但在运行时,应用程序和配置库和最多时配置反应本土矢量图标,我已经“构建失败”。

> Configure project :react-native-vector-icons
The CompileOptions.bootClasspath property has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the CompileOptions.bootstrapClasspath property instead.


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex Unable to merge dex

所以我不知道什么是错的,请如果你有同样的问题,他们固定的,帮我

javascript java android react-native react-native-navigation
1个回答
0
投票

对于屏幕和路由和导航之间的导航为您做出反应的本机应用,您可以切换反应导航3X https://reactnavigation.org/。它的可扩展且易于使用的完全是用JavaScript编写的导航解决方案(这样你就可以阅读和理解所有的源),在强大的原生元之上。

如果你已经熟悉本地做出反应,那么你就可以得到与快速反应导航感动!

在你的阵营本地项目安装反应导航包。

yarn add react-navigation

或NPM

npm install --save react-navigation

接下来,安装反应母语手势处理程序。如果你使用的世博会,你不需要在这里做任何事情,它包含在SDK中。除此以外:

yarn add react-native-gesture-handler

或NPM

npm install --save react-native-gesture-handler

链接所有本地依赖关系:

react-native link react-native-gesture-handler

需要为iOS没有额外的步骤。

要完成安装react-native-gesture-handler为Android的,一定要进行必要的修改,以MainActivity.java

package com.reactnavigation.example;

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 {

  @Override
  protected String getMainComponentName() {
    return "Example";
  }

  @Override
  protected ReactActivityDelegate createReactActivityDelegate() {
    return new ReactActivityDelegate(this, getMainComponentName()) {
      @Override
      protected ReactRootView createRootView() {
       return new RNGestureHandlerEnabledRootView(MainActivity.this);
      }
    };
  }
}

你是好去!

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