UNPKG

rn-quick-actions

Version:

iOS Home screen Quick Actions & Android App Shortcuts for react-native

87 lines (86 loc) 2.38 kB
import { EmitterSubscription } from 'react-native'; export interface ShortcutItem { /** * Unique string used to identify the type of the action */ id: string; /** * On Android - it's recommended to keep this under 25 characters. If there * isn't enough space to display this, fallsback to `shortTitle` */ title: string; /** * Android only, max 10 characters recommended. This is displayed instead of * `title` when there is not enough space to display the title. */ shortTitle?: string; /** * iOS only, ignored on Android */ subtitle?: string; /** * The name of the iOS Asset or Android drawable */ iconName?: string; /** * The name of the iOS SF Symbol Name */ symbolName?: string; /** * [Android] The name of the person */ personName?: string; /** * [Android] The url to image for person */ personIcon?: string; /** * [Android] Is long-lived */ longLived?: boolean; /** * Custom payload for the action */ data?: any; } interface ShortcutItemIOS extends Omit<ShortcutItem, 'id'> { type: string; } /** * Maps a ShortcutItem to ShortcutItemIOS by converting id to type */ export declare const mapToIOSShortcut: (item: ShortcutItem) => ShortcutItemIOS; /** * Maps a ShortcutItemIOS to ShortcutItem by converting type to id */ export declare const mapFromIOSShortcut: (item: ShortcutItemIOS) => ShortcutItem; declare class Shortcuts { /** * Set the shortcut items. * @returns a promise with the items that were set */ setShortcuts(items: ShortcutItem[]): Promise<ShortcutItem[]>; /** * Add the shortcut item. * @returns a promise with boolean */ addShortcut(shortcutItem: ShortcutItem): Promise<boolean>; /** * @returns a promise with the items that were set */ getShortcuts(): Promise<ShortcutItem[]>; /** * Removes all the shortcut items */ clearShortcuts(): void; /** * Gets the initial shortcut the app was launched with */ getInitialShortcut(): Promise<ShortcutItem | null>; /** * Listens for new shortcut events */ onShortcutPressed(handler: (shortcut: ShortcutItem) => void): EmitterSubscription; } declare const _default: Shortcuts; export default _default;