import React, { useCallback } from "react"; import Close from "../../../icons/navigation/Close"; import { Box, Text, IconButton, Toast } from "native-base"; import { AccessibilityProps, Dimensions, Platform, StyleProp, ViewStyle, } from "react-native"; import { EnhancedTouchableOpacity } from "../EnhancedTouchableOpacity"; export interface ISnackbar { id: number | string; title?: React.ReactNode | string; buttonTitle?: string; flexDirection?: "row" | "column"; onPress?: () => void; as?: React.ComponentType; showButton?: boolean; style?: StyleProp; } const KEY = "SNACKBAR"; export const ACCESSIBILITY = { BUTTON_TITLE: `${KEY}-BUTTON-TITLE`, TEXT: `${KEY}-TEXT`, VIEW: `${KEY}-VIEW`, BUTTON_CLOSE: `${KEY}-BUTTON-CLOSE`, BUTTON_TEXT: `${KEY}-BUTTON-TEXT`, }; export const TEST_ID = { TEXT: `id.flip.staging:id/${KEY}-TEXT`, }; export const Snackbar: React.FC = (props) => { const { id, title, buttonTitle, onPress, flexDirection, as, showButton = true, style, } = props; const onClose = useCallback(() => { Toast.close(id); }, [id]); return ( {title} {showButton ? ( buttonTitle ? ( {buttonTitle} ) : ( } /> ) ) : null} ); }; export default Snackbar;