forked from lucas.delanier/MovieFinder
parent
1a99571791
commit
c4cb072d9b
@ -0,0 +1,9 @@
|
|||||||
|
API_URL = https://api.themoviedb.org/3/movie/550?api_key=a133422b5b1f22428e8074470d321865
|
||||||
|
IMAGE = https://image.tmdb.org/t/p/w500/kqjL17yufvn9OVLyXYpvtyrFfak.jpg
|
||||||
|
|
||||||
|
JETON = eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJhMTMzNDIyYjViMWYyMjQyOGU4MDc0NDcwZDMyMTg2NSIsInN1YiI6IjYzZGE1MDA5YTZjMTA0MDA4NTg3YTc3YiIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.EfOvULIxDJ2hrltaGwdRUkAE1wd1HCHtkCP835z7PaY
|
||||||
|
|
||||||
|
<SafeAreaProvider>
|
||||||
|
<Navigation colorScheme={colorScheme} />
|
||||||
|
<StatusBar />
|
||||||
|
</SafeAreaProvider>
|
@ -0,0 +1,11 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
|
||||||
|
export default axios.create({
|
||||||
|
baseURL: 'https://api.themoviedb.org/3',
|
||||||
|
headers:{
|
||||||
|
Accept: "application/json"
|
||||||
|
},
|
||||||
|
params: {
|
||||||
|
api_key: 'a133422b5b1f22428e8074470d321865'
|
||||||
|
}
|
||||||
|
})
|
@ -0,0 +1,45 @@
|
|||||||
|
import {Image, StyleSheet, Text, View} from "react-native";
|
||||||
|
import {BadgeFilm} from "../screens/HomeScreen";
|
||||||
|
import * as React from "react";
|
||||||
|
|
||||||
|
|
||||||
|
type ListWidgetProps = {
|
||||||
|
imageURL : string
|
||||||
|
name : String
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
filmCard: {
|
||||||
|
width: 70,
|
||||||
|
height: 100,
|
||||||
|
borderRadius: 8,
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
export function ListWidget(props: ListWidgetProps) {
|
||||||
|
return (
|
||||||
|
<View style={{height: 100, borderRadius: 20, justifyContent: "flex-start", flexDirection: 'row', paddingHorizontal:20, marginVertical:5}} >
|
||||||
|
<Image
|
||||||
|
style={styles.filmCard}
|
||||||
|
source={{
|
||||||
|
uri: 'https://fr.web.img4.acsta.net/pictures/21/11/16/10/01/4860598.jpg',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<View style={{height: 100, borderRadius: 20, justifyContent: "flex-start", flexDirection: 'column', paddingLeft:10}} >
|
||||||
|
<Text style={{color: "white", fontWeight:"bold", fontSize:25}}>{props.name}</Text>
|
||||||
|
<Text style={{color: "grey", fontWeight:"bold", fontSize:17}}>{props.name}</Text>
|
||||||
|
<View style={{marginVertical:10}}>
|
||||||
|
<BadgeFilm name={"Science-Ficton"}/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
import {useEffect, useState} from "react";
|
||||||
|
import {View} from "react-native";
|
||||||
|
import {ListWidget} from "./ListWidget";
|
||||||
|
import tmdb from "../api/tmdb"
|
||||||
|
|
||||||
|
const MovieList = () => {
|
||||||
|
const [movies,setMovies] = useState([])
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
const fetchMovies = async() =>{
|
||||||
|
const {data}= await tmdb.get("movie/popular")
|
||||||
|
setMovies(data.results)
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchMovies()
|
||||||
|
},[])
|
||||||
|
|
||||||
|
return <View>
|
||||||
|
{movies.map((movie, index)=>{
|
||||||
|
return <ListWidget name={Object.assign({}, movie)}></ListWidget>
|
||||||
|
})}
|
||||||
|
</View>
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MovieList;
|
@ -0,0 +1,3 @@
|
|||||||
|
export interface Movie{
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in new issue