import React, { useState } from 'react'; import { ActivityIndicator, View } from 'react-native'; import FastImage from 'react-native-fast-image'; import colors from '../../styles/colors'; const CoverArt: React.FC<{ PlaceholderComponent: () => JSX.Element, height: number, width: number, coverArtUri?: string }> = ({ PlaceholderComponent, height, width, coverArtUri }) => { const [placeholderVisible, setPlaceholderVisible] = useState(false); const [loading, setLoading] = useState(true); const indicatorSize = height > 130 ? 'large' : 'small'; const halfIndicatorHeight = indicatorSize === 'large' ? 18 : 10; const Placeholder: React.FC<{ visible: boolean }> = ({ visible }) => ( ); const CoverArt = () => ( <> { setLoading(false); setPlaceholderVisible(true); }} onLoadEnd={() => setLoading(false)} /> ); return ( {!coverArtUri ? : } ); } export default React.memo(CoverArt);