mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-03-11 17:45:38 +00:00
Merge pull request #445 from chrisk325/patch-12
better approach for imdb logo using remote svg lib
This commit is contained in:
commit
5fa793e1f5
1 changed files with 27 additions and 11 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import React, { useEffect, useState, useRef, useCallback, useMemo } from 'react';
|
||||
import { SvgUri } from 'react-native-svg';
|
||||
import { View, Text, StyleSheet, ActivityIndicator, Image, Animated, Dimensions } from 'react-native';
|
||||
import { MaterialIcons as MaterialIconsWrapper } from '@expo/vector-icons';
|
||||
import { useTheme } from '../../contexts/ThemeContext';
|
||||
|
|
@ -162,8 +163,8 @@ export const RatingsSection: React.FC<RatingsSectionProps> = ({ imdbId, type })
|
|||
const ratingConfig = {
|
||||
imdb: {
|
||||
name: 'IMDb',
|
||||
icon: { uri: IMDb_LOGO },
|
||||
isImage: false,
|
||||
icon: IMDb_LOGO,
|
||||
isRemoteSvg: true,
|
||||
color: '#F5C518',
|
||||
transform: (value: number) => value.toFixed(1)
|
||||
},
|
||||
|
|
@ -244,10 +245,24 @@ export const RatingsSection: React.FC<RatingsSectionProps> = ({ imdbId, type })
|
|||
|
||||
return (
|
||||
<View key={source} style={[styles.compactRatingItem, { marginRight: itemSpacing }]}>
|
||||
{config.isImage ? (
|
||||
{config.isRemoteSvg ? (
|
||||
<SvgUri
|
||||
uri={config.icon as string}
|
||||
width={source === 'imdb' ? iconSize * 2 : iconSize}
|
||||
height={iconSize}
|
||||
style={{ marginRight: iconTextGap }}
|
||||
/>
|
||||
) : config.isImage ? (
|
||||
<Image
|
||||
source={config.icon as any}
|
||||
style={[styles.compactRatingIcon, { width: source === 'imdb' ? iconSize * 2 : iconSize, height: iconSize, marginRight: iconTextGap }]}
|
||||
style={[
|
||||
styles.compactRatingIcon,
|
||||
{
|
||||
width: source === 'imdb' ? iconSize * 2 : iconSize,
|
||||
height: iconSize,
|
||||
marginRight: iconTextGap,
|
||||
},
|
||||
]}
|
||||
resizeMode="contain"
|
||||
/>
|
||||
) : config.icon ? (
|
||||
|
|
@ -258,13 +273,14 @@ export const RatingsSection: React.FC<RatingsSectionProps> = ({ imdbId, type })
|
|||
})}
|
||||
</View>
|
||||
) : (
|
||||
// Text fallback
|
||||
<Text style={{
|
||||
color: config.color,
|
||||
fontSize: textSize,
|
||||
fontWeight: '900',
|
||||
marginRight: iconTextGap
|
||||
}}>
|
||||
<Text
|
||||
style={{
|
||||
color: config.color,
|
||||
fontSize: textSize,
|
||||
fontWeight: '900',
|
||||
marginRight: iconTextGap,
|
||||
}}
|
||||
>
|
||||
{config.name}
|
||||
</Text>
|
||||
)}
|
||||
|
|
|
|||
Loading…
Reference in a new issue