UNPKG

alert-toast-react-native

Version:

## Example Dialog Box

359 lines (358 loc) 10.2 kB
import * as React from 'react'; import { SafeAreaInsetsContext } from 'react-native-safe-area-context'; import { ALERT_TYPE } from '../config/ENV'; export declare type IConfig = { type?: ALERT_TYPE; title?: string; textBody?: string; autoClose?: number | boolean; onPress?: () => void; onLongPress?: () => void; onShow?: () => void; onHide?: () => void; }; declare type IProps = { isDark: boolean; config?: Pick<IConfig, 'autoClose'>; }; declare type IState = { styles: ReturnType<typeof __styles>; cardHeight: number; overlayClose?: boolean; visible: boolean; config?: IConfig; }; declare class Toast extends React.Component<IProps, IState> { /** * @type {React.Context<EdgeInsets | null>} */ static contextType: React.Context<import("react-native-safe-area-context").EdgeInsets | null>; /** * @type {React.RefObject<Toast>} */ static instance: React.RefObject<Toast>; /** * @param {IConfig} args */ static show: (args: IConfig) => void; /** * */ static hide: () => void; /** * @type {React.ContextType<typeof SafeAreaInsetsContext>} */ context: React.ContextType<typeof SafeAreaInsetsContext>; /** * @type {Animated.Value} * @private */ private _positionToast; /** * @type {number} * @private */ private _cardHeight; /** * @type {NodeJS.Timeout} * @private */ private _timeout?; /** * @param {IProps} props * @param {React.ContextType<typeof SafeAreaInsetsContext>} context */ constructor(props: IProps, context: React.ContextType<typeof SafeAreaInsetsContext>); /** * @param {Readonly<IProps>} prevProps */ componentDidUpdate: (prevProps: Readonly<IProps>) => void; /** * @param {IConfig} args * @return {Promise<void>} */ private _open; /** * @return {Promise<void>} */ private _close; /** * @param {ACTION} action * @return {Promise<void>} */ private _startAnimation; /** * @return {JSX.Element} */ private _CardRender; /** * @return {JSX.Element} */ render: () => JSX.Element; } declare const __styles: (isDark: boolean) => { [x: string]: { backgroundColor: string; position: "absolute"; left: 0; right: 0; top: 0; bottom: 0; zIndex?: undefined; flexDirection?: undefined; borderRadius?: undefined; paddingHorizontal?: undefined; paddingTop?: undefined; paddingBottom?: undefined; marginHorizontal?: undefined; marginBottom?: undefined; fontWeight?: undefined; fontSize?: undefined; color?: undefined; alignSelf?: undefined; height?: undefined; width?: undefined; aspectRatio?: undefined; marginRight?: undefined; tintColor?: undefined; } | { position: "absolute"; backgroundColor: string; top: number; left: number; right: number; zIndex?: undefined; flexDirection?: undefined; borderRadius?: undefined; paddingHorizontal?: undefined; paddingTop?: undefined; paddingBottom?: undefined; marginHorizontal?: undefined; marginBottom?: undefined; fontWeight?: undefined; fontSize?: undefined; color?: undefined; alignSelf?: undefined; height?: undefined; width?: undefined; aspectRatio?: undefined; marginRight?: undefined; tintColor?: undefined; } | { zIndex: number; position: "absolute"; left: number; right: number; backgroundColor?: undefined; top?: undefined; flexDirection?: undefined; borderRadius?: undefined; paddingHorizontal?: undefined; paddingTop?: undefined; paddingBottom?: undefined; marginHorizontal?: undefined; marginBottom?: undefined; fontWeight?: undefined; fontSize?: undefined; color?: undefined; alignSelf?: undefined; height?: undefined; width?: undefined; aspectRatio?: undefined; marginRight?: undefined; tintColor?: undefined; } | { flexDirection: "row"; borderRadius: number; paddingHorizontal: number; paddingTop: number; paddingBottom: number; marginHorizontal: number; marginBottom: number; backgroundColor: string | typeof import("react-native").OpaqueColorValue | undefined; position?: undefined; top?: undefined; left?: undefined; right?: undefined; zIndex?: undefined; fontWeight?: undefined; fontSize?: undefined; color?: undefined; alignSelf?: undefined; height?: undefined; width?: undefined; aspectRatio?: undefined; marginRight?: undefined; tintColor?: undefined; } | { fontWeight: "bold"; fontSize: number; color: string | typeof import("react-native").OpaqueColorValue | undefined; position?: undefined; backgroundColor?: undefined; top?: undefined; left?: undefined; right?: undefined; zIndex?: undefined; flexDirection?: undefined; borderRadius?: undefined; paddingHorizontal?: undefined; paddingTop?: undefined; paddingBottom?: undefined; marginHorizontal?: undefined; marginBottom?: undefined; alignSelf?: undefined; height?: undefined; width?: undefined; aspectRatio?: undefined; marginRight?: undefined; tintColor?: undefined; } | { color: string | typeof import("react-native").OpaqueColorValue | undefined; position?: undefined; backgroundColor?: undefined; top?: undefined; left?: undefined; right?: undefined; zIndex?: undefined; flexDirection?: undefined; borderRadius?: undefined; paddingHorizontal?: undefined; paddingTop?: undefined; paddingBottom?: undefined; marginHorizontal?: undefined; marginBottom?: undefined; fontWeight?: undefined; fontSize?: undefined; alignSelf?: undefined; height?: undefined; width?: undefined; aspectRatio?: undefined; marginRight?: undefined; tintColor?: undefined; } | { position: "absolute"; alignSelf: "center"; height: number; width: number; backgroundColor: string; borderRadius: number; left: number; top?: undefined; right?: undefined; zIndex?: undefined; flexDirection?: undefined; paddingHorizontal?: undefined; paddingTop?: undefined; paddingBottom?: undefined; marginHorizontal?: undefined; marginBottom?: undefined; fontWeight?: undefined; fontSize?: undefined; color?: undefined; aspectRatio?: undefined; marginRight?: undefined; tintColor?: undefined; } | { alignSelf: "center"; width: number; aspectRatio: number; marginRight: number; position?: undefined; backgroundColor?: undefined; top?: undefined; left?: undefined; right?: undefined; zIndex?: undefined; flexDirection?: undefined; borderRadius?: undefined; paddingHorizontal?: undefined; paddingTop?: undefined; paddingBottom?: undefined; marginHorizontal?: undefined; marginBottom?: undefined; fontWeight?: undefined; fontSize?: undefined; color?: undefined; height?: undefined; tintColor?: undefined; } | { tintColor: string | typeof import("react-native").OpaqueColorValue | undefined; position?: undefined; backgroundColor?: undefined; top?: undefined; left?: undefined; right?: undefined; zIndex?: undefined; flexDirection?: undefined; borderRadius?: undefined; paddingHorizontal?: undefined; paddingTop?: undefined; paddingBottom?: undefined; marginHorizontal?: undefined; marginBottom?: undefined; fontWeight?: undefined; fontSize?: undefined; color?: undefined; alignSelf?: undefined; height?: undefined; width?: undefined; aspectRatio?: undefined; marginRight?: undefined; }; backgroundContainer: { backgroundColor: string; position: "absolute"; left: 0; right: 0; top: 0; bottom: 0; }; container: { position: "absolute"; backgroundColor: string; top: number; left: number; right: number; }; cardRow: { zIndex: number; position: "absolute"; left: number; right: number; }; cardContainer: { flexDirection: "row"; borderRadius: number; paddingHorizontal: number; paddingTop: number; paddingBottom: number; marginHorizontal: number; marginBottom: number; backgroundColor: string | typeof import("react-native").OpaqueColorValue | undefined; }; titleLabel: { fontWeight: "bold"; fontSize: number; color: string | typeof import("react-native").OpaqueColorValue | undefined; }; descLabel: { color: string | typeof import("react-native").OpaqueColorValue | undefined; }; backendImage: { position: "absolute"; alignSelf: "center"; height: number; width: number; backgroundColor: string; borderRadius: number; left: number; }; image: { alignSelf: "center"; width: number; aspectRatio: number; marginRight: number; }; }; export default Toast;