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 | disabledButtonTintColor?: ColorValue | ProcessedColorValue | undefined;
|
26 | userInterfaceStyle?: 'light' | 'dark' | undefined;
|
27 | disabledButtonIndices?: number[] | undefined;
|
28 | }
|
29 |
|
30 | export interface ShareActionSheetIOSOptions {
|
31 | message?: string | undefined;
|
32 | url?: string | undefined;
|
33 | subject?: string | undefined;
|
34 | anchor?: number | undefined;
|
35 | /** The activities to exclude from the ActionSheet.
|
36 | * For example: ['com.apple.UIKit.activity.PostToTwitter']
|
37 | */
|
38 | excludedActivityTypes?: string[] | undefined;
|
39 | }
|
40 |
|
41 | /**
|
42 | * @see https://reactnative.dev/docs/actionsheetios#content
|
43 | */
|
44 | export interface ActionSheetIOSStatic {
|
45 | /**
|
46 | * Display an iOS action sheet. The `options` object must contain one or more
|
47 | * of:
|
48 | * - `options` (array of strings) - a list of button titles (required)
|
49 | * - `cancelButtonIndex` (int) - index of cancel button in `options`
|
50 | * - `destructiveButtonIndex` (int) - index of destructive button in `options`
|
51 | * - `title` (string) - a title to show above the action sheet
|
52 | * - `message` (string) - a message to show below the title
|
53 | */
|
54 | showActionSheetWithOptions: (
|
55 | options: ActionSheetIOSOptions,
|
56 | callback: (buttonIndex: number) => void,
|
57 | ) => void;
|
58 |
|
59 | /**
|
60 | * Display the iOS share sheet. The `options` object should contain
|
61 | * one or both of `message` and `url` and can additionally have
|
62 | * a `subject` or `excludedActivityTypes`:
|
63 | *
|
64 | * - `url` (string) - a URL to share
|
65 | * - `message` (string) - a message to share
|
66 | * - `subject` (string) - a subject for the message
|
67 | * - `excludedActivityTypes` (array) - the activities to exclude from the ActionSheet
|
68 | *
|
69 | * NOTE: if `url` points to a local file, or is a base64-encoded
|
70 | * uri, the file it points to will be loaded and shared directly.
|
71 | * In this way, you can share images, videos, PDF files, etc.
|
72 | */
|
73 | showShareActionSheetWithOptions: (
|
74 | options: ShareActionSheetIOSOptions,
|
75 | failureCallback: (error: Error) => void,
|
76 | successCallback: (success: boolean, method: string) => void,
|
77 | ) => void;
|
78 |
|
79 | /**
|
80 | * Dismisses the most upper iOS action sheet presented, if no action sheet is
|
81 | * present a warning is displayed.
|
82 | */
|
83 | dismissActionSheet: () => void;
|
84 | }
|
85 |
|
86 | export const ActionSheetIOS: ActionSheetIOSStatic;
|
87 | export type ActionSheetIOS = ActionSheetIOSStatic;
|