/** * @license * Copyright Akveo. All Rights Reserved. * Licensed under the MIT License. See License.txt in the project root for license information. */ import React from 'react'; import { StyleProp, ViewStyle } from 'react-native'; /** * Singleton service designed to manage modal components. * * @type ModalServiceType * * @method {(element: React.ReactElement, config: ModalPresentingConfig) => string} show - * Shows component in a modal window. Returns its id. * * @method {(identifier: string) => string} hide - Hides component from a modal window and returns empty string. * * @method {(identifier: string, children: React.ReactNode) => void} update - Updates component from a modal window. * * @example Simple Usage * * ``` * import React from 'react'; * import { Layout, Button, Text, ModalService } from '../..'; * * export const ModalServiceShowcase = () => { * * const modalID = ''; * * const showModal = () => { * const contentElement = this.renderModalContentElement(); * this.modalID = ModalService.show(contentElement, { onBackdropPress: this.hideModal }); * }; * * const hideModal = () => { * ModalService.hide(this.modalID); * }; * * const renderModalContentElement = () => { * return ( * * Hi, I'm modal! * * ); * }; * * return ( * * * * * ); * } * ``` */ declare class ModalServiceType { panel: ModalPresenting | null; mount(panel: ModalPresenting | null): void; unmount(): void; show(element: React.ReactElement, config: ModalPresentingConfig): string; update(identifier: string, children: React.ReactElement): void; hide(identifier: string): string; } export interface ModalPresentingConfig { backdropStyle?: StyleProp; onBackdropPress?: () => void; } export interface ModalPresenting { show(element: React.ReactElement, config: ModalPresentingConfig): string; hide(identifier: string): string; update(identifier: string, children: React.ReactElement): void; } export declare const ModalService: ModalServiceType; export {};