1 | /**
|
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
|
3 | *
|
4 | * This source code is licensed under the MIT license found in the
|
5 | * LICENSE file in the root directory of this source tree.
|
6 | *
|
7 | * @format
|
8 | */
|
9 |
|
10 | import {ProcessedColorValue} from '../StyleSheet/processColor';
|
11 | import {ColorValue} from '../StyleSheet/StyleSheet';
|
12 |
|
13 | /**
|
14 | * @see: https://reactnative.dev/docs/actionsheetios#content
|
15 | */
|
16 | export interface ActionSheetIOSOptions {
|
17 | title?: string | undefined;
|
18 | options: string[];
|
19 | cancelButtonIndex?: number | undefined;
|
20 | destructiveButtonIndex?: number | number[] | undefined | null;
|
21 | message?: string | undefined;
|
22 | anchor?: number | undefined;
|
23 | tintColor?: ColorValue | ProcessedColorValue | undefined;
|
24 | cancelButtonTintColor?: ColorValue | ProcessedColorValue | undefined;
|
25 | userInterfaceStyle?: 'light' | 'dark' | undefined;
|
26 | disabledButtonIndices?: number[] | undefined;
|
27 | }
|
28 |
|
29 | export interface ShareActionSheetIOSOptions {
|
30 | message?: string | undefined;
|
31 | url?: string | undefined;
|
32 | subject?: string | undefined;
|
33 | anchor?: number | undefined;
|
34 | /** The activities to exclude from the ActionSheet.
|
35 | * For example: ['com.apple.UIKit.activity.PostToTwitter']
|
36 | */
|
37 | excludedActivityTypes?: string[] | undefined;
|
38 | }
|
39 |
|
40 | /**
|
41 | * @see https://reactnative.dev/docs/actionsheetios#content
|
42 | */
|
43 | export interface ActionSheetIOSStatic {
|
44 | /**
|
45 | * Display an iOS action sheet. The `options` object must contain one or more
|
46 | * of:
|
47 | * - `options` (array of strings) - a list of button titles (required)
|
48 | * - `cancelButtonIndex` (int) - index of cancel button in `options`
|
49 | * - `destructiveButtonIndex` (int) - index of destructive button in `options`
|
50 | * - `title` (string) - a title to show above the action sheet
|
51 | * - `message` (string) - a message to show below the title
|
52 | */
|
53 | showActionSheetWithOptions: (
|
54 | options: ActionSheetIOSOptions,
|
55 | callback: (buttonIndex: number) => void,
|
56 | ) => void;
|
57 |
|
58 | /**
|
59 | * Display the iOS share sheet. The `options` object should contain
|
60 | * one or both of `message` and `url` and can additionally have
|
61 | * a `subject` or `excludedActivityTypes`:
|
62 | *
|
63 | * - `url` (string) - a URL to share
|
64 | * - `message` (string) - a message to share
|
65 | * - `subject` (string) - a subject for the message
|
66 | * - `excludedActivityTypes` (array) - the activities to exclude from the ActionSheet
|
67 | *
|
68 | * NOTE: if `url` points to a local file, or is a base64-encoded
|
69 | * uri, the file it points to will be loaded and shared directly.
|
70 | * In this way, you can share images, videos, PDF files, etc.
|
71 | */
|
72 | showShareActionSheetWithOptions: (
|
73 | options: ShareActionSheetIOSOptions,
|
74 | failureCallback: (error: Error) => void,
|
75 | successCallback: (success: boolean, method: string) => void,
|
76 | ) => void;
|
77 |
|
78 | /**
|
79 | * Dismisses the most upper iOS action sheet presented, if no action sheet is
|
80 | * present a warning is displayed.
|
81 | */
|
82 | dismissActionSheet: () => void;
|
83 | }
|
84 |
|
85 | export const ActionSheetIOS: ActionSheetIOSStatic;
|
86 | export type ActionSheetIOS = ActionSheetIOSStatic;
|