React-Native - reanimated-bottom-sheet - 无法向上/向下拖动底部表

FLa*_*ash 3 react-native react-native-reanimated

我有一个使用reanimated-bottom-sheet包创建的底部工作表,如下所示

<BottomSheet
                ref={this.bottomSheetRef}
                snapPoints={[0, 270]}
                renderContent={() => <TextEditor/>}
                renderHeader={() => <View style={{ height: 70, backgroundColor: 'red' }}><Text>HEADER</Text></View>}
                enabledBottomClamp={true}
                callbackNode={fall}
                enabledInnerScrolling={false}
            />
Run Code Online (Sandbox Code Playgroud)

我可以使用this.bottomSheetRef.current.snapTo(1)/打开/关闭底部的床单this.bottomSheetRef.current.snapTo(0)

但是当向下滑动正文/标题时,工作表不会关闭。

小智 6

您可能错误地安装了库react-native-gesture-handler。更新您的 MainActivity.java 文件(或您创建 ReactActivityDelegate 实例的任何地方),以便它覆盖负责创建 ReactRootView 实例的方法,然后使用此库提供的根视图包装器。不要忘记导入 ReactActivityDelegate、ReactRootView 和 RNGestureHandlerEnabledRootView:

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);
+      }
+    };
+  }
}
Run Code Online (Sandbox Code Playgroud)