【问题标题】:React Native app keeps stopping after react-native-gesture-handler install安装 react-native-gesture-handler 后,React Native 应用程序一直停止
【发布时间】:2019-09-05 23:28:07
【问题描述】:

最近我用 React Native 0.60 启动了一个应用程序,第一次构建运行良好,但是在安装和配置 react-native-gesture-handler 后,应用程序一直在我的模拟器中停止。它没有错误,只是一直停止。我所做的唯一更改是添加这些包。

这是我的 MainActivity.java,带有手势处理程序所需的配置

package com.ggwp;

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 "ggWP";
    }

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

【问题讨论】:

    标签: android reactjs react-native


    【解决方案1】:

    可能与AndroidX 相关的迁移有关,该迁移在react native version 0.60+ 之后开始

    您可能必须在 install jetifier 之前 npx Jetify 这将加载 androidX 库。

    还可以尝试删除节点模块文件夹,然后重新安装它们。重新链接手势处理程序库,然后在 gradle.properties 中添加 androidX 迁移工具和一些 tweek 以使用 androidX 库。

    【讨论】:

    • 抱歉回复晚了,但还是一样。我再次安装了所有模块,使用了 jetifier,并且应用程序一直停止。我不知道还能做什么。
    • 降级 react 原生手势处理器版本
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-01
    • 2023-04-03
    • 2019-12-28
    • 2019-11-15
    • 1970-01-01
    相关资源
    最近更新 更多