GameOverScreen.js
1.45 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { View, Image, Text, StyleSheet } from "react-native";
import Title from "../components/ui/Title";
import PrimaryButton from "../components/ui/PrimaryButton";
import Colors from "../constants/colors";
function GameOverScreen({ roundsNumber, userNumber, onStartNewGame }) {
return (
<View style={styles.rootContainer}>
<Title>GAME OVER!</Title>
<View style={styles.imageContainer}>
<Image
style={styles.image}
source={require("../assets/images/success.png")}
/>
</View>
<Text style={styles.summaryText}>
Your phone needed <Text style={styles.highlight}>{roundsNumber}</Text>{" "}
rounds to guess the number{" "}
<Text style={styles.highlight}>{userNumber}</Text>.
</Text>
<PrimaryButton onPress={onStartNewGame}>Start New Game</PrimaryButton>
</View>
);
}
export default GameOverScreen;
const styles = StyleSheet.create({
rootContainer: {
flex: 1,
padding: 24,
justifyContent: "center",
alignItems: "center",
},
imageContainer: {
width: 300,
height: 300,
borderRadius: 150,
borderWidth: 3,
borderColor: Colors.primary800,
overflow: "hidden",
margin: 36,
},
image: {
width: "100%",
height: "100%",
},
summaryText: {
fontFamily: "open-sans",
fontSize: 24,
textAlign: "center",
marginBottom: 24,
},
highlight: {
fontFamily: "open-sans-bold",
color: Colors.primary500,
},
});