-
Notifications
You must be signed in to change notification settings - Fork 4
/
MovieListScene.js
42 lines (39 loc) · 928 Bytes
/
MovieListScene.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import React, { useState } from "react";
import { StyleSheet, SafeAreaView, TextInput } from "react-native";
import MovieList from "./MovieList";
import rest from "./MovieRest";
export default function MovieListScene(props) {
const [movies, setMovies] = useState([]);
return (
<SafeAreaView style={styles.container}>
<TextInput
style={styles.input}
placeholder="Search"
onChangeText={(text) => {
rest.search(text, setMovies);
}}
/>
<MovieList
navigate={(movie) =>
props.navigation.navigate("Detail", {
movieId: movie.imdbID,
title: movie.Title,
})
}
movies={movies}
/>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "white",
},
input: {
height: 50,
margin: 5,
color: "black",
fontSize: 20,
},
});