UNPKG

react-web-native-sketch

Version:

[TODO: We need an overview of how this can be used via npm vs as a local package]

133 lines (132 loc) 4.02 kB
import * as React from 'react'; export declare const DEFAULT_ALERT_ID = "DEFAULT_ALERT_ID"; export declare enum TypeKeys { TOGGLE_DRAWER = "instacar/navigation/TOGGLE_DRAWER", POP_PAGE = "instacar/navigation/POP", WEB_ROUTE_CHANGED = "instacar/navigation/WEB_ROUTE_CHANGED", SHOW_DIALOG = "instacar/navigation/SHOW_DIALOG", HIDE_DIALOG = "instacar/navigation/HIDE_DIALOG", REMOVE_DIALOG = "instacar/navigation/REMOVE_DIALOG", PUSH_SCREEN = "instacar/navigation/PUSH_SCREEN", SHOW_ALERT = "instacar/navigation/SHOW_ALERT", HIDE_ALERT = "instacar/navigation/HIDE_ALERT" } export declare enum PushTypes { MODAL = 0, MODAL_FULL_SCREEN = 1, CARD = 2 } export interface RouteDefintion { screen: string; container: React.ComponentType; pushType?: PushTypes; title: string; } export interface Navigation { navigation: any; } export interface History { history: any; } export interface ToggleDrawerAction { type: TypeKeys.TOGGLE_DRAWER; drawerOpen?: boolean; } export interface PopPageAction { type: TypeKeys.POP_PAGE; } export interface WebRouteChangedAction { type: TypeKeys.WEB_ROUTE_CHANGED; screen: string; } export interface PushScreenAction { type: TypeKeys.PUSH_SCREEN; screen: string; props: any; } export interface ShowDialogAction { type: TypeKeys.SHOW_DIALOG; id: string; fullScreen: boolean; props: any; } export interface HideDialogAction { type: TypeKeys.HIDE_DIALOG; id: string; } export interface RemoveDialogAction { type: TypeKeys.REMOVE_DIALOG; id: string; } export interface ShowAlertAction { type: TypeKeys.SHOW_ALERT; alertId: string; body: string; bodyData?: Object; leftButtonText?: string; rightButtonText?: string; } export interface HideAlertAction { type: TypeKeys.HIDE_ALERT; alertId: string; body: string; } export declare type ActionTypes = ToggleDrawerAction | PopPageAction | WebRouteChangedAction | PushScreenAction | ShowDialogAction | HideDialogAction | RemoveDialogAction | ShowAlertAction | HideAlertAction; export interface DialogData { id: string; visible: boolean; fullScreen: boolean; props: any; } export interface AlertData { alertId: string; body: string; bodyData?: Object; visible: boolean; leftButtonText?: string; rightButtonText?: string; } export interface NavigationState { screen: string; drawerOpen: boolean; screenProps?: any; props: any; dialogs: Array<DialogData>; alerts: Array<AlertData>; } export declare const initialState: { screen: string; drawerOpen: boolean; props: null; dialogs: never[]; alerts: never[]; }; export interface Route { screen: string; container: React.ComponentType; title: string; pushType?: PushTypes; } export declare let routes: { [route: string]: Route; }; export declare const navigation: (state: NavigationState | undefined, action: ActionTypes) => NavigationState; export declare const toggleDrawer: (navigation: any, drawerOpen?: boolean | undefined) => { type: TypeKeys; drawerOpen: boolean | undefined; }; export declare const pushScreen: (navigation: any, history: any, routeDefinition: RouteDefintion, props: any) => PushScreenAction | ShowDialogAction; export declare const popScreen: (navigation: any, history: any) => (dispatch: any, getState: () => { navigation: NavigationState; }) => void; export declare function hideDialog(id: string): HideDialogAction; export declare function removeDialog(id: string): RemoveDialogAction; export declare const setRoutes: (targetRoutes: { [route: string]: Route; }) => void; export declare const showAlert: (body: string, bodyData?: Object | undefined, alertId?: string, leftButtonText?: string | undefined, rightButtonText?: string | undefined) => ShowAlertAction; export declare const hideAlert: (body: string, alertId?: string) => { type: TypeKeys; alertId: string; body: string; };