import React, { useState } from 'react'; import { Text, View } from 'react-native'; import { BorderlessButton, ScrollView } from 'react-native-gesture-handler'; import Modal from 'react-native-modal'; import Markdown, { MarkdownPreview } from '../../containers/markdown'; import { CustomIcon } from '../../lib/Icons'; import { themes } from '../../lib/constants'; import styles from './styles'; import { useTheme } from '../../theme'; interface IBannerProps { text?: string; title?: string; bannerClosed?: boolean; closeBanner: () => void; } const Banner = React.memo( ({ text, title, bannerClosed, closeBanner }: IBannerProps) => { const [showModal, openModal] = useState(false); const { theme } = useTheme(); const toggleModal = () => openModal(prevState => !prevState); if (text && !bannerClosed) { return ( <> {title} ); } return null; }, (prevProps, nextProps) => prevProps.text === nextProps.text && prevProps.bannerClosed === nextProps.bannerClosed ); export default Banner;