抽屉一旦轻按以关闭便无法打开

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

当前行为

在React导航5中

抽屉在openDrawer()和closeDrawer()事件上正确打开和关闭,但是在使用滑动手势打开抽屉时遇到问题。

复制步骤:-1)打开抽屉一次2)点按抽屉外部并关闭。3)滑动以打开抽屉。 (这里遇到问题,无法打开)

react-native react-navigation react-navigation-drawer
1个回答
0
投票

您是否已遵循react-native-gesture-handler的所有安装说明?

来自https://software-mansion.github.io/react-native-gesture-handler/docs/getting-started.html

“更新您的MainActivity.java文件:”

package com.swmansion.gesturehandler.react.example;

import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;  //Add this...
import com.facebook.react.ReactRootView;  //...and this...
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView; //...and this

public class MainActivity extends ReactActivity {

  @Override
  protected String getMainComponentName() {
    return "Example";
  }
//Add this function
  @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.