The translation was generated automatically and may contain mistakes

RouteNavigator.showModal

Opens the modal window specified by the parameters.

Example

TypeScript
import { useRouteNavigator } from '@vkontakte/vk-mini-apps-router'; export function SomePage() { const routeNavigator = useRouteNavigator(); return ( // ?1?’ызов метода <Button onClick={() => routeNavigator.showModal(`modal_contacts`)}>Контакты</Button> ); }

Announcement

TypeScript
showModal(id: string, options?: { state?: Object }): Promise<void>;

Parameters

Parameter
Type
Description
id Mandatory
string
The modal window that needs to be opened.
options
object
The object that describes transition properties .

Properties of Transition

Поле
Type
Description
state optional
object
A value or object that will be passed to a new page. Details of use - in the section Passing Parameters .

Result

Object Promise which is allowed if the modal window has been opened successfully. Works for official purposes. Using this object in your code is usually unnecessary.

Features of use

  • •

    Modal and pop-up windows opened when the method is called showModal will be hidden.

  • •

    The method does not change the current URL of the application, but adds a record of opening a modal window to the transition history.
    If a modal window opens on top of another modal window, the method replaces the history entry rather than adding a new one.

Materials on the topic