|
|
@ -17,11 +17,19 @@ import {useSafeAreaInsets} from "react-native-safe-area-context";
|
|
|
|
import {addMovieToWatchLater, getTrendingID, removeMovieTrending,} from "../redux/actions/actionGetTrendingID";
|
|
|
|
import {addMovieToWatchLater, getTrendingID, removeMovieTrending,} from "../redux/actions/actionGetTrendingID";
|
|
|
|
import {useDispatch, useSelector} from 'react-redux';
|
|
|
|
import {useDispatch, useSelector} from 'react-redux';
|
|
|
|
import Movie from "../model/Movie";
|
|
|
|
import Movie from "../model/Movie";
|
|
|
|
|
|
|
|
import * as url from "url";
|
|
|
|
|
|
|
|
import moment from 'moment';
|
|
|
|
|
|
|
|
|
|
|
|
export default function HomeScreen({ navigation }: RootStackScreenProps<'Home'>) {
|
|
|
|
export default function HomeScreen({navigation}: RootStackScreenProps<'Home'>) {
|
|
|
|
// @ts-ignore
|
|
|
|
// @ts-ignore
|
|
|
|
const trendingMovies = useSelector(state => state.appReducer.trendingMovies);
|
|
|
|
const trendingMovies = useSelector(state => state.appReducer.trendingMovies);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const [hours, setHours] = useState(0);
|
|
|
|
|
|
|
|
const [minutes, setMinutes] = useState(0);
|
|
|
|
|
|
|
|
const [seconds, setSeconds] = useState(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//console.log("liste [0]: ", trendingMovies[0]);
|
|
|
|
//console.log("liste [0]: ", trendingMovies[0]);
|
|
|
|
|
|
|
|
|
|
|
|
const insets = useSafeAreaInsets();
|
|
|
|
const insets = useSafeAreaInsets();
|
|
|
@ -30,23 +38,22 @@ export default function HomeScreen({ navigation }: RootStackScreenProps<'Home'>)
|
|
|
|
background: {
|
|
|
|
background: {
|
|
|
|
backgroundColor: 'black',
|
|
|
|
backgroundColor: 'black',
|
|
|
|
height: '100%',
|
|
|
|
height: '100%',
|
|
|
|
|
|
|
|
width: '100%',
|
|
|
|
paddingTop: insets.top,
|
|
|
|
paddingTop: insets.top,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
container:{
|
|
|
|
container: {
|
|
|
|
flex: 1,
|
|
|
|
flex: 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
filmCard: {
|
|
|
|
filmCard: {
|
|
|
|
width: '80%',
|
|
|
|
width: '85%',
|
|
|
|
height: '60%',
|
|
|
|
height: '68%',
|
|
|
|
justifyContent:'center',
|
|
|
|
justifyContent: 'center',
|
|
|
|
marginLeft:'auto',
|
|
|
|
marginLeft: 'auto',
|
|
|
|
marginRight:'auto',
|
|
|
|
marginRight: 'auto',
|
|
|
|
borderRadius: 15,
|
|
|
|
borderRadius: 22,
|
|
|
|
|
|
|
|
marginTop: 15,
|
|
|
|
},
|
|
|
|
alignItems: 'center',
|
|
|
|
image: {
|
|
|
|
|
|
|
|
position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, justifyContent: 'center', alignItems: 'center',
|
|
|
|
|
|
|
|
shadowColor: "#000",
|
|
|
|
shadowColor: "#000",
|
|
|
|
shadowOffset: {
|
|
|
|
shadowOffset: {
|
|
|
|
width: 0,
|
|
|
|
width: 0,
|
|
|
@ -54,10 +61,10 @@ export default function HomeScreen({ navigation }: RootStackScreenProps<'Home'>)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
shadowOpacity: 0.39,
|
|
|
|
shadowOpacity: 0.39,
|
|
|
|
shadowRadius: 8.30,
|
|
|
|
shadowRadius: 8.30,
|
|
|
|
flex: 1,
|
|
|
|
|
|
|
|
paddingTop: 70,
|
|
|
|
|
|
|
|
alignSelf: 'center',
|
|
|
|
alignSelf: 'center',
|
|
|
|
elevation: 13,
|
|
|
|
elevation: 13,
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
backgroundImage: {
|
|
|
|
backgroundImage: {
|
|
|
|
flex: 1,
|
|
|
|
flex: 1,
|
|
|
@ -67,6 +74,14 @@ export default function HomeScreen({ navigation }: RootStackScreenProps<'Home'>)
|
|
|
|
flex: 1,
|
|
|
|
flex: 1,
|
|
|
|
backgroundColor: 'rgba(0,0,0,0.5)',
|
|
|
|
backgroundColor: 'rgba(0,0,0,0.5)',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
circle: {
|
|
|
|
|
|
|
|
width: 6,
|
|
|
|
|
|
|
|
height: 6,
|
|
|
|
|
|
|
|
borderRadius: 100 / 2,
|
|
|
|
|
|
|
|
marginTop: 4,
|
|
|
|
|
|
|
|
backgroundColor: "lightgray",
|
|
|
|
|
|
|
|
marginHorizontal: 8
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -74,6 +89,36 @@ export default function HomeScreen({ navigation }: RootStackScreenProps<'Home'>)
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
|
|
// Créez une date avec la valeur actuelle
|
|
|
|
|
|
|
|
const interval = setInterval(() => {
|
|
|
|
|
|
|
|
const today = moment();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Définissez l'heure sur minuit
|
|
|
|
|
|
|
|
today.set({hour: 0, minute: 0, second: 0, millisecond: 0});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Ajoutez un jour pour obtenir demain (ce soir à minuit)
|
|
|
|
|
|
|
|
const tonight = today.add(1, 'days');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Obtenez le timestamp en millisecondes
|
|
|
|
|
|
|
|
const timestamp = tonight.valueOf();
|
|
|
|
|
|
|
|
const now = new Date();
|
|
|
|
|
|
|
|
const difference = timestamp - now.getTime();
|
|
|
|
|
|
|
|
const h = Math.floor(
|
|
|
|
|
|
|
|
(difference % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setHours(h);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const m = Math.floor((difference % (1000 * 60 * 60)) / (1000 * 60));
|
|
|
|
|
|
|
|
setMinutes(m);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const s = Math.floor((difference % (1000 * 60)) / 1000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setSeconds(s);
|
|
|
|
|
|
|
|
//console.log("timer", h, m, s);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
setTimeout(() => interval, 10000);
|
|
|
|
|
|
|
|
|
|
|
|
const loadTrendingID = async () => {
|
|
|
|
const loadTrendingID = async () => {
|
|
|
|
// @ts-ignore
|
|
|
|
// @ts-ignore
|
|
|
|
await dispatch(getTrendingID());
|
|
|
|
await dispatch(getTrendingID());
|
|
|
@ -83,15 +128,17 @@ export default function HomeScreen({ navigation }: RootStackScreenProps<'Home'>)
|
|
|
|
}, [dispatch]);
|
|
|
|
}, [dispatch]);
|
|
|
|
|
|
|
|
|
|
|
|
type ItemProps = {
|
|
|
|
type ItemProps = {
|
|
|
|
movie : Movie
|
|
|
|
movie: Movie
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function addWatchLater(props: Movie){
|
|
|
|
|
|
|
|
dispatch(addMovieToWatchLater(props));
|
|
|
|
function addWatchLater(props: Movie) {
|
|
|
|
dispatch(removeMovieTrending(props));
|
|
|
|
dispatch(addMovieToWatchLater(props));
|
|
|
|
|
|
|
|
dispatch(removeMovieTrending(props));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function popFirstTrending(props: Movie){
|
|
|
|
|
|
|
|
|
|
|
|
function popFirstTrending(props: Movie) {
|
|
|
|
dispatch(removeMovieTrending(props));
|
|
|
|
dispatch(removeMovieTrending(props));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -101,121 +148,99 @@ export default function HomeScreen({ navigation }: RootStackScreenProps<'Home'>)
|
|
|
|
const minutes = time % 60;
|
|
|
|
const minutes = time % 60;
|
|
|
|
return `${hours}h ${minutes < 10 ? `0${minutes}` : minutes}m`;
|
|
|
|
return `${hours}h ${minutes < 10 ? `0${minutes}` : minutes}m`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let rotateValueHolder = new Animated.Value(0);
|
|
|
|
let rotateValueHolder = new Animated.Value(0);
|
|
|
|
|
|
|
|
|
|
|
|
function startImageRotateFunction(){
|
|
|
|
|
|
|
|
rotateValueHolder.setValue(0);
|
|
|
|
|
|
|
|
Animated.timing(rotateValueHolder, {
|
|
|
|
|
|
|
|
toValue: 0.5,
|
|
|
|
|
|
|
|
duration: 800,
|
|
|
|
|
|
|
|
easing: Easing.linear,
|
|
|
|
|
|
|
|
useNativeDriver: true,
|
|
|
|
|
|
|
|
}).start();}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const RotateData = rotateValueHolder.interpolate({
|
|
|
|
|
|
|
|
inputRange: [0, 1],
|
|
|
|
|
|
|
|
outputRange: ['0deg', '360deg'],
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return(
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<>
|
|
|
|
{trendingMovies.length !== 0 && (
|
|
|
|
{trendingMovies.length !== 0 && (
|
|
|
|
<SafeAreaView style={styles.background}>
|
|
|
|
<SafeAreaView style={styles.background}>
|
|
|
|
<ImageBackground blurRadius={8}
|
|
|
|
<ImageBackground blurRadius={8}
|
|
|
|
style={{
|
|
|
|
style={{
|
|
|
|
position: 'absolute',
|
|
|
|
position: 'absolute',
|
|
|
|
width: "200%",
|
|
|
|
width: "200%",
|
|
|
|
height: "200%",
|
|
|
|
height: "200%",
|
|
|
|
justifyContent: "center",
|
|
|
|
justifyContent: "center",
|
|
|
|
alignItems: "center",
|
|
|
|
alignItems: "center",
|
|
|
|
opacity: 0.48
|
|
|
|
opacity: 0.68
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
source={{
|
|
|
|
source={{
|
|
|
|
uri: trendingMovies[0].poster_path,
|
|
|
|
uri: trendingMovies[0].poster_path,
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
></ImageBackground>
|
|
|
|
></ImageBackground>
|
|
|
|
<View style={styles.image}>
|
|
|
|
<View style={{flexDirection: 'column', alignSelf: 'center', paddingHorizontal: 30, width: '100%', alignItems: "center"}}>
|
|
|
|
|
|
|
|
<Text numberOfLines={1} style={{color: "white", fontSize: 30, fontWeight: "bold", paddingTop: 5, alignSelf: "center"}}>{trendingMovies[0].original_title}</Text>
|
|
|
|
|
|
|
|
<View style={{flexDirection: 'row', justifyContent: "center", alignItems: "center", alignSelf: "center"}}>
|
|
|
|
|
|
|
|
<Text style={{color: "#AAAAAA", fontSize: 20, fontWeight: "normal", paddingTop: 5}}>{`${trendingMovies[0].release_date}`}</Text>
|
|
|
|
|
|
|
|
<View style={styles.circle}/>
|
|
|
|
|
|
|
|
<Text style={{color: "#AAAAAA", fontSize: 20, fontWeight: "normal", paddingTop: 5}}>{`${trendingMovies[0].genres[0]}, ${trendingMovies[0].genres[1]}`}</Text>
|
|
|
|
|
|
|
|
<View style={styles.circle}/>
|
|
|
|
|
|
|
|
<Text style={{color: "#AAAAAA", fontSize: 20, fontWeight: "normal", paddingTop: 5}}>{`${formatTime(trendingMovies[0].runtime)}`}</Text>
|
|
|
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
<Stars note={Math.round(trendingMovies[0].vote_average)}/>
|
|
|
|
|
|
|
|
</View>
|
|
|
|
<Image
|
|
|
|
<Image
|
|
|
|
style={styles.filmCard}
|
|
|
|
style={styles.filmCard}
|
|
|
|
source={{
|
|
|
|
source={{
|
|
|
|
uri: trendingMovies[0].poster_path,
|
|
|
|
uri: trendingMovies[0].poster_path,
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</View>
|
|
|
|
<View style={{flexDirection: 'row', alignItems: 'flex-end', justifyContent: "space-evenly", paddingHorizontal: 30, width: '100%', position: "absolute", top: "79%", zIndex: 30}}>
|
|
|
|
<View style={{height:35, marginTop: 10, marginBottom: 15}}>
|
|
|
|
<TouchableOpacity onPress={() => addWatchLater(trendingMovies[0])}>
|
|
|
|
<ScrollView
|
|
|
|
<Image
|
|
|
|
horizontal={true}
|
|
|
|
source={require('../assets/images/watchlater_button.png')} style={{resizeMode: "stretch", height: '55%', aspectRatio: 1,}}
|
|
|
|
showsHorizontalScrollIndicator={false}>
|
|
|
|
/>
|
|
|
|
<BadgeGenre name={"Popular"} isSelected={false}></BadgeGenre>
|
|
|
|
</TouchableOpacity>
|
|
|
|
<BadgeGenre name={"Trending"} isSelected={true}></BadgeGenre>
|
|
|
|
<TouchableOpacity onPress={
|
|
|
|
<BadgeGenre name={"Classic"} isSelected={false}></BadgeGenre>
|
|
|
|
() => popFirstTrending(trendingMovies[0])}>
|
|
|
|
<BadgeGenre name={"New"} isSelected={false}></BadgeGenre>
|
|
|
|
<Animated.Image
|
|
|
|
<BadgeGenre name={"Cartoon"} isSelected={false}></BadgeGenre>
|
|
|
|
source={require('../assets/images/delete_button.png')} style={{
|
|
|
|
<BadgeGenre name={"Serie"} isSelected={false}></BadgeGenre>
|
|
|
|
resizeMode: "stretch", height: '55%', aspectRatio: 1,
|
|
|
|
<BadgeGenre name={"cc"} isSelected={false}></BadgeGenre>
|
|
|
|
}}
|
|
|
|
<BadgeGenre name={"cc"} isSelected={false}></BadgeGenre>
|
|
|
|
/>
|
|
|
|
<BadgeGenre name={"cc"} isSelected={false}></BadgeGenre>
|
|
|
|
|
|
|
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
|
|
|
<TouchableOpacity>
|
|
|
|
|
|
|
|
<Image
|
|
|
|
</ScrollView>
|
|
|
|
source={require('../assets/images/like_button.png')} style={{resizeMode: "stretch", height: '55%', aspectRatio: 1,}}
|
|
|
|
</View>
|
|
|
|
/>
|
|
|
|
<View style={{ flexDirection: 'column', alignSelf: 'flex-start', alignItems: 'flex-start', paddingHorizontal: 30, flex: 1 }}>
|
|
|
|
|
|
|
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
<View style={{ flexDirection: 'row', alignSelf: 'flex-start', justifyContent: 'flex-start', width: "100%"}}>
|
|
|
|
|
|
|
|
<FlatList horizontal
|
|
|
|
|
|
|
|
data={trendingMovies[0].genres}
|
|
|
|
|
|
|
|
renderItem={({item}) => <BadgeFilm name={item}></BadgeFilm>}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
<View>
|
|
|
|
<View style={{zIndex: 10, alignItems: "center", justifyContent: "center", flex: 1, flexDirection: "row"}}>
|
|
|
|
<Text numberOfLines={1} style={{color: "white", fontSize: 28, fontWeight: "bold", paddingTop: 5}}>{trendingMovies[0].original_title}</Text>
|
|
|
|
<Text style={{color: "#FFF", fontSize: 16, fontWeight: "500"}}>Nouvelle collection dans</Text>
|
|
|
|
|
|
|
|
<Image source={require('../assets/images/timer_icon.png')} style={{
|
|
|
|
|
|
|
|
height: 30,
|
|
|
|
|
|
|
|
resizeMode: 'contain'
|
|
|
|
|
|
|
|
}}></Image>
|
|
|
|
|
|
|
|
<Text style={{color: "#FFF", fontSize: 16, fontWeight: "500"}}>{`${hours.toString().padStart(2, '0')}:`}</Text>
|
|
|
|
|
|
|
|
<Text style={{color: "#FFF", fontSize: 16, fontWeight: "500"}}>{`${minutes.toString().padStart(2, '0')}:`}</Text>
|
|
|
|
|
|
|
|
<Text style={{color: "#FFF", fontSize: 16, fontWeight: "500"}}>{`${seconds.toString().padStart(2, '0')}`}</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
<Text style={{color: "lightgray", fontSize: 20, fontWeight: "bold"}}>{trendingMovies[0].release_date}</Text>
|
|
|
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
<View style={{ flexDirection: 'row' ,alignItems: 'center', justifyContent: "space-evenly", paddingHorizontal: 30, height: '20%', width:'100%'}}>
|
|
|
|
|
|
|
|
<TouchableOpacity onPress={() => addWatchLater(trendingMovies[0])}>
|
|
|
|
|
|
|
|
<Image
|
|
|
|
|
|
|
|
source={require('../assets/images/WatchLater.png')} style={{ resizeMode:"stretch", height:'45%', aspectRatio: 1,}}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
|
|
|
<TouchableOpacity onPress={
|
|
|
|
|
|
|
|
() => popFirstTrending(trendingMovies[0]) }>
|
|
|
|
|
|
|
|
<Animated.Image
|
|
|
|
|
|
|
|
source={require('../assets/images/Generate.png')} style={{resizeMode:"stretch", height:'45%',aspectRatio: 1,transform: [{ rotate: RotateData }],
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
|
|
|
<TouchableOpacity>
|
|
|
|
|
|
|
|
<Image
|
|
|
|
|
|
|
|
source={require('../assets/images/Favorite.png')} style={{ resizeMode:"stretch", height:'45%', aspectRatio: 1,}}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
</SafeAreaView>)}
|
|
|
|
</View>
|
|
|
|
|
|
|
|
</SafeAreaView>)}
|
|
|
|
|
|
|
|
</>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
type BadgeGenreProps = {
|
|
|
|
type BadgeGenreProps = {
|
|
|
|
name : String
|
|
|
|
name: String
|
|
|
|
isSelected: Boolean
|
|
|
|
isSelected: Boolean
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function BadgeGenre(props: BadgeGenreProps) {
|
|
|
|
export function BadgeGenre(props: BadgeGenreProps) {
|
|
|
|
if(props.isSelected===false){
|
|
|
|
if (props.isSelected === false) {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<View style={{paddingHorizontal: 20, marginHorizontal: 5,height: 35, backgroundColor: '#2E2E2E', borderRadius: 20, justifyContent: "center"}} >
|
|
|
|
<View style={{paddingHorizontal: 20, marginHorizontal: 5, height: 35, backgroundColor: '#2E2E2E', borderRadius: 20, justifyContent: "center"}}>
|
|
|
|
<Text style={{color: "white"}}>{props.name}</Text>
|
|
|
|
<Text style={{color: "white"}}>{props.name}</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else{
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<View style={{paddingHorizontal: 20, marginHorizontal: 5,height: 35, backgroundColor: '#5C5C5C', borderRadius: 20, borderWidth: 1, borderColor: "white" ,justifyContent: "center"}} >
|
|
|
|
<View style={{paddingHorizontal: 20, marginHorizontal: 5, height: 35, backgroundColor: '#5C5C5C', borderRadius: 20, borderWidth: 1, borderColor: "white", justifyContent: "center"}}>
|
|
|
|
<Text style={{color: "white"}}>{props.name}</Text>
|
|
|
|
<Text style={{color: "white"}}>{props.name}</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
|
@ -226,25 +251,57 @@ export function BadgeGenre(props: BadgeGenreProps) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type BadgeFilmProps = {
|
|
|
|
type BadgeFilmProps = {
|
|
|
|
name : String
|
|
|
|
name: String
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function BadgeFilm(props: BadgeFilmProps) {
|
|
|
|
export function BadgeFilm(props: BadgeFilmProps) {
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<View style={{
|
|
|
|
<View style={{
|
|
|
|
paddingHorizontal: 15,
|
|
|
|
paddingHorizontal: 15,
|
|
|
|
marginHorizontal: 5,
|
|
|
|
marginHorizontal: 5,
|
|
|
|
height: 30,
|
|
|
|
height: 30,
|
|
|
|
backgroundColor: '#8906B8',
|
|
|
|
backgroundColor: '#8906B8',
|
|
|
|
borderRadius: 15,
|
|
|
|
borderRadius: 15,
|
|
|
|
justifyContent: "center",
|
|
|
|
justifyContent: "center",
|
|
|
|
alignSelf: "flex-start"
|
|
|
|
alignSelf: "flex-start"
|
|
|
|
}}>
|
|
|
|
}}>
|
|
|
|
<Text style={{color: "white", fontSize: 12, fontWeight: "bold"}}>{props.name}</Text>
|
|
|
|
<Text style={{color: "white", fontSize: 12, fontWeight: "bold"}}>{props.name}</Text>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type StarsProps = {
|
|
|
|
|
|
|
|
note: number
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function Stars(props: StarsProps) {
|
|
|
|
|
|
|
|
console.log("note", props.note)
|
|
|
|
|
|
|
|
let imageSource;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (props.note < 2)
|
|
|
|
|
|
|
|
imageSource = require('../assets/images/1stars_vote.png');
|
|
|
|
|
|
|
|
else if (props.note < 4)
|
|
|
|
|
|
|
|
imageSource = require('../assets/images/2stars_vote.png');
|
|
|
|
|
|
|
|
else if (props.note < 6)
|
|
|
|
|
|
|
|
imageSource = require('../assets/images/3stars_vote.png');
|
|
|
|
|
|
|
|
else if (props.note < 8)
|
|
|
|
|
|
|
|
imageSource = require('../assets/images/4stars_vote.png');
|
|
|
|
|
|
|
|
else if (props.note < 10)
|
|
|
|
|
|
|
|
imageSource = require('../assets/images/5stars_vote.png');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
<View>
|
|
|
|
|
|
|
|
<Image source={imageSource} style={{
|
|
|
|
|
|
|
|
width: 130,
|
|
|
|
|
|
|
|
height: 40,
|
|
|
|
|
|
|
|
resizeMode: 'contain'
|
|
|
|
|
|
|
|
}}/>
|
|
|
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
};
|
|
|
|