Skip to main content
Version: 7.x

DrawerActions 参考

DrawerActions 是一个对象,包含用于生成特定于基于抽屉的导航器的操作的方法。其方法扩展了 CommonActions 中可用的操作。

¥DrawerActions is an object containing methods for generating actions specific to drawer-based navigators. Its methods expand upon the actions available in CommonActions.

支持以下操作:

¥The following actions are supported:

openDrawer

openDrawer 动作可用于打开抽屉面板。

¥The openDrawer action can be used to open the drawer pane.

navigation.dispatch(DrawerActions.openDrawer());
Try on Snack

closeDrawer

closeDrawer 操作可用于关闭抽屉面板。

¥The closeDrawer action can be used to close the drawer pane.

navigation.dispatch(DrawerActions.closeDrawer());
Try on Snack

toggleDrawer

toggleDrawer 操作可用于打开抽屉面板(如果已关闭)或关闭(如果已打开)。

¥The toggleDrawer action can be used to open the drawer pane if closed, or close if open.

navigation.dispatch(DrawerActions.toggleDrawer());
Try on Snack

jumpTo

jumpTo 操作可用于跳转到抽屉式导航器中的现有路由。

¥The jumpTo action can be used to jump to an existing route in the drawer navigator.

  • name - string - 要跳转到的路由名称。

    ¥name - string - Name of the route to jump to.

  • params - object - 屏幕参数传递到目标路由。

    ¥params - object - Screen params to pass to the destination route.

navigation.dispatch(jumpToAction);
Try on Snack