当前行为
在React导航5中
抽屉在openDrawer()和closeDrawer()事件上正确打开和关闭,但是在使用滑动手势打开抽屉时遇到问题。
复制步骤:-1)打开抽屉一次2)点按抽屉外部并关闭。3)滑动以打开抽屉。 (这里遇到问题,无法打开)
您是否已遵循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);
}
};
}
}