/* eslint-disable lines-around-comment */ import React from 'react'; import { WithTranslation } from 'react-i18next'; import { Animated, Text, View } from 'react-native'; import { translate } from '../../../base/i18n/functions'; import { Icon, IconCloseLarge, IconInfoCircle, IconUsers, IconWarning // @ts-ignore } from '../../../base/icons'; import { colors } from '../../../base/ui/Tokens'; import BaseTheme from '../../../base/ui/components/BaseTheme.native'; import Button from '../../../base/ui/components/native/Button'; import IconButton from '../../../base/ui/components/native/IconButton'; import { BUTTON_MODES, BUTTON_TYPES } from '../../../base/ui/constants.native'; import { replaceNonUnicodeEmojis } from '../../../chat/functions'; import { NOTIFICATION_ICON } from '../../constants'; import AbstractNotification, { type Props as AbstractNotificationProps // @ts-ignore } from '../AbstractNotification'; // @ts-ignore import styles from './styles'; /** * Secondary colors for notification icons. * * @type {{error, info, normal, success, warning}} */ const ICON_COLOR = { error: colors.error06, normal: colors.primary06, success: colors.success05, warning: colors.warning05 }; export type Props = AbstractNotificationProps & WithTranslation & { _participants: ArrayLike; }; /** * Implements a React {@link Component} to display a notification. * * @augments Component */ class Notification extends AbstractNotification { /** * Initializes a new {@code Notification} instance. * * @inheritdoc */ constructor(props: Props) { super(props); // @ts-ignore this.state = { notificationContainerAnimation: new Animated.Value(0) }; } /** * Implements React's {@link Component#componentDidMount()}. * * @inheritdoc */ componentDidMount() { Animated.timing( // @ts-ignore this.state.notificationContainerAnimation, { toValue: 1, duration: 500, useNativeDriver: true }) .start(); } /** * Creates action button configurations for the notification based on * notification appearance. * * @private * @returns {Object[]} */ _mapAppearanceToButtons() { const { customActionHandler, customActionNameKey, customActionType // @ts-ignore } = this.props; if (customActionNameKey?.length && customActionHandler?.length && customActionType?.length) { return customActionNameKey?.map((customAction: string, index: number) => (