UNPKG

1.44 kBTypeScriptView Raw
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/**
11 * This exposes the native ToastAndroid module as a JS module. This has a function 'show'
12 * which takes the following parameters:
13 *
14 * 1. String message: A string with the text to toast
15 * 2. int duration: The duration of the toast. May be ToastAndroid.SHORT or ToastAndroid.LONG
16 *
17 * There is also a function `showWithGravity` to specify the layout gravity. May be
18 * ToastAndroid.TOP, ToastAndroid.BOTTOM, ToastAndroid.CENTER
19 */
20export interface ToastAndroidStatic {
21 /**
22 * String message: A string with the text to toast
23 * int duration: The duration of the toast.
24 * May be ToastAndroid.SHORT or ToastAndroid.LONG
25 */
26 show(message: string, duration: number): void;
27 /** `gravity` may be ToastAndroid.TOP, ToastAndroid.BOTTOM, ToastAndroid.CENTER */
28 showWithGravity(message: string, duration: number, gravity: number): void;
29
30 showWithGravityAndOffset(
31 message: string,
32 duration: number,
33 gravity: number,
34 xOffset: number,
35 yOffset: number,
36 ): void;
37 // Toast duration constants
38 SHORT: number;
39 LONG: number;
40 // Toast gravity constants
41 TOP: number;
42 BOTTOM: number;
43 CENTER: number;
44}
45
46export const ToastAndroid: ToastAndroidStatic;
47export type ToastAndroid = ToastAndroidStatic;