Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 爱奥尼亚+;使用ionic hardware back按钮关闭Cupertino窗格或任何第三方覆盖或模式_Reactjs_Ionic Framework - Fatal编程技术网

Reactjs 爱奥尼亚+;使用ionic hardware back按钮关闭Cupertino窗格或任何第三方覆盖或模式

Reactjs 爱奥尼亚+;使用ionic hardware back按钮关闭Cupertino窗格或任何第三方覆盖或模式,reactjs,ionic-framework,Reactjs,Ionic Framework,我使用一个名为的库,我想使用hardware backbutton关闭窗格,但它不起作用。我把窗格做成了一个我称之为IonDrawer的组件 我试过: // Trying to get access to the backButton in the Component useEffect(() => { if (Capacitor.isNative) { App.addListener("backButton", (ev: any) =&

我使用一个名为的库,我想使用hardware backbutton关闭窗格,但它不起作用。我把窗格做成了一个我称之为IonDrawer的组件

我试过:

    // Trying to get access to the backButton in the Component

 useEffect(() => {
    if (Capacitor.isNative) {
      App.addListener("backButton", (ev: any) => {
        ev.detail.register(100, async () => {
           hidePanel();
           // this is a hack that made the page stays by not navigating to the previous route.
           history.push(getPath);
        });
      });
    }
  });

const hidePanel = async () => {
  console.log("Tapped");
  isShowing.current = false;
  await drawerRef.current?.destroy({ animate: true });
};