Skip to content

Commit 967faf8

Browse files
committed
added different screen
1 parent 20d6b18 commit 967faf8

3 files changed

Lines changed: 89 additions & 0 deletions

File tree

screens/about.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from "react";
2+
import { StyleSheet, Text, View } from "react-native";
3+
4+
const About = () => {
5+
return (
6+
<View style={styles.container}>
7+
<Text>About Screen</Text>
8+
</View>
9+
);
10+
};
11+
12+
const styles = StyleSheet.create({
13+
container: {
14+
padding: 24,
15+
},
16+
});
17+
18+
export default About;

screens/home.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import React, { useState } from "react";
2+
import {
3+
Button,
4+
FlatList,
5+
StyleSheet,
6+
Text,
7+
TouchableOpacity,
8+
View,
9+
} from "react-native";
10+
import { globalStyles } from "../styles/global";
11+
import { useNavigation } from "@react-navigation/native";
12+
const Home = () => {
13+
const navigation = useNavigation();
14+
const [reviews, setReviews] = useState([
15+
{
16+
title: "Zelda, Breath of Fresh Air",
17+
rating: 5,
18+
body: "lorem ipsum",
19+
key: "1",
20+
},
21+
{
22+
title: "Gotta Catch Them All (again)",
23+
rating: 4,
24+
body: "lorem ipsum",
25+
key: "2",
26+
},
27+
{
28+
title: 'Not So "Final" Fantasy',
29+
rating: 3,
30+
body: "lorem ipsum",
31+
key: "3",
32+
},
33+
]);
34+
return (
35+
<View style={globalStyles.container}>
36+
<FlatList
37+
data={reviews}
38+
renderItem={({ item }) => (
39+
<TouchableOpacity
40+
onPress={() => {
41+
navigation.navigate("ReviewDetails", item);
42+
}}
43+
>
44+
<Text style={globalStyles.titleText}>{item.title}</Text>
45+
</TouchableOpacity>
46+
)}
47+
/>
48+
</View>
49+
);
50+
};
51+
52+
export default Home;

screens/reviewDetails.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from "react";
2+
import { StyleSheet, Text, View } from "react-native";
3+
import { useRoute } from "@react-navigation/native";
4+
const ReviewDetails = () => {
5+
const route = useRoute();
6+
return (
7+
<View style={styles.container}>
8+
<Text>{route.params.title}</Text>
9+
</View>
10+
);
11+
};
12+
13+
const styles = StyleSheet.create({
14+
container: {
15+
padding: 24,
16+
},
17+
});
18+
19+
export default ReviewDetails;

0 commit comments

Comments
 (0)