|
|
|
@ -1,10 +1,13 @@
|
|
|
|
|
import * as React from 'react';
|
|
|
|
|
import {Button,TouchableOpacity,ScrollView,View, Text, StyleSheet, Image, ImageBackground, SafeAreaView} from 'react-native';
|
|
|
|
|
import {RootStackScreenProps} from "../types.js";
|
|
|
|
|
import {RootStackScreenProps} from "../types";
|
|
|
|
|
import Rive from 'rive-react-native';
|
|
|
|
|
import {useRef} from "react";
|
|
|
|
|
import {useEffect, useRef} from "react";
|
|
|
|
|
import {RiveViewManager} from "rive-react-native/lib/typescript/Rive.js";
|
|
|
|
|
import {useSafeAreaInsets} from "react-native-safe-area-context";
|
|
|
|
|
import {getTrendingID, } from "../redux/actions/actionGetTrendingID";
|
|
|
|
|
import {useDispatch, useSelector} from 'react-redux';
|
|
|
|
|
import Movie from "../model/Movie.js";
|
|
|
|
|
|
|
|
|
|
export default function App({ navigation }: RootStackScreenProps<'Home'>) {
|
|
|
|
|
const riveRef = useRef();
|
|
|
|
@ -54,9 +57,27 @@ export default function App({ navigation }: RootStackScreenProps<'Home'>) {
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
const trendingMovies = useSelector(state => state.appReducer.trendingMovies);
|
|
|
|
|
|
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
|
|
|
|
|
let firstelement: Movie = trendingMovies[0];
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const loadTrendingID = async () => {
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
await dispatch(getTrendingID());
|
|
|
|
|
};
|
|
|
|
|
loadTrendingID();
|
|
|
|
|
firstelement = trendingMovies[0];
|
|
|
|
|
}, [dispatch]);
|
|
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
const onPress = () => this.setState({trendingMovies: trendingMovies.shift()}) ;
|
|
|
|
|
return (
|
|
|
|
|
<SafeAreaView style={styles.background}>
|
|
|
|
|
|
|
|
|
|
<ImageBackground blurRadius={20}
|
|
|
|
|
style={{
|
|
|
|
|
position: 'absolute',
|
|
|
|
@ -67,14 +88,14 @@ export default function App({ navigation }: RootStackScreenProps<'Home'>) {
|
|
|
|
|
opacity: 0.28
|
|
|
|
|
}}
|
|
|
|
|
source={{
|
|
|
|
|
uri: 'https://fr.web.img4.acsta.net/pictures/21/11/16/10/01/4860598.jpg',
|
|
|
|
|
uri: firstelement.poster_path,
|
|
|
|
|
}}
|
|
|
|
|
></ImageBackground>
|
|
|
|
|
<View style={styles.image}>
|
|
|
|
|
<Image
|
|
|
|
|
style={styles.filmCard}
|
|
|
|
|
source={{
|
|
|
|
|
uri: 'https://fr.web.img4.acsta.net/pictures/21/11/16/10/01/4860598.jpg',
|
|
|
|
|
uri: firstelement.poster_path,
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</View>
|
|
|
|
@ -104,12 +125,12 @@ export default function App({ navigation }: RootStackScreenProps<'Home'>) {
|
|
|
|
|
<BadgeFilm name={"9:11"}></BadgeFilm>
|
|
|
|
|
</View>
|
|
|
|
|
<View>
|
|
|
|
|
<Text numberOfLines={1} style={{color: "white", fontSize: 28, fontWeight: "bold", paddingTop: 5}}>SPIDER-MAN No Way Home</Text>
|
|
|
|
|
<Text numberOfLines={1} style={{color: "white", fontSize: 28, fontWeight: "bold", paddingTop: 5}}>{firstelement.original_title}</Text>
|
|
|
|
|
</View>
|
|
|
|
|
<Text style={{color: "grey", fontSize: 20, fontWeight: "bold"}}>Jean-Marc généreux</Text>
|
|
|
|
|
<Text style={{color: "grey", fontSize: 20, fontWeight: "bold"}}>{firstelement.release_date}</Text>
|
|
|
|
|
</View>
|
|
|
|
|
<View style={{ flexDirection: 'row' ,alignItems: 'center', justifyContent: "space-evenly", paddingHorizontal: 30, height: '15%', width:'100%'}}>
|
|
|
|
|
<TouchableOpacity>
|
|
|
|
|
<TouchableOpacity onPress={onPress}>
|
|
|
|
|
<Image
|
|
|
|
|
source={require('../assets/images/WatchLater.png')} style={{ resizeMode:"stretch", height:'65%', aspectRatio: 1,}}
|
|
|
|
|
/>
|
|
|
|
@ -166,8 +187,16 @@ type BadgeFilmProps = {
|
|
|
|
|
export function BadgeFilm(props: BadgeFilmProps) {
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<View style={{paddingHorizontal: 15, marginHorizontal: 5,height: 30, backgroundColor: '#8906B8', borderRadius: 15, justifyContent: "center"}} >
|
|
|
|
|
<Text style={{color: "white", fontSize: 12, fontWeight:"bold"}}>{props.name}</Text>
|
|
|
|
|
<View style={{
|
|
|
|
|
paddingHorizontal: 15,
|
|
|
|
|
marginHorizontal: 5,
|
|
|
|
|
height: 30,
|
|
|
|
|
backgroundColor: '#8906B8',
|
|
|
|
|
borderRadius: 15,
|
|
|
|
|
justifyContent: "center",
|
|
|
|
|
alignSelf: "flex-start"
|
|
|
|
|
}}>
|
|
|
|
|
<Text style={{color: "white", fontSize: 12, fontWeight: "bold"}}>{props.name}</Text>
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
|