-
Notifications
You must be signed in to change notification settings - Fork 956
/
Copy pathWelcomeScreen.tsx
117 lines (111 loc) · 3.4 KB
/
WelcomeScreen.tsx
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import React from "react"
import { SafeAreaView } from "react-native-safe-area-context"
import { NavigationProp, useNavigation } from "@react-navigation/native"
import { Image, ImageStyle, ScrollView, TextStyle, View, ViewStyle } from "react-native"
import { ListItem as ListItemParent, ListItemProps, Text } from "app/components"
import { AppStackParamList, AppStackScreenProps } from "app/navigators"
import { colors, spacing } from "app/theme"
const welcomeLogo = require("../../assets/images/logo.png")
interface WelcomeScreenProps extends AppStackScreenProps<"Welcome"> {}
type WelcomeScreenNavigationProp = NavigationProp<AppStackParamList, "Welcome">
export const WelcomeScreen: React.FC<WelcomeScreenProps> = function WelcomeScreen() {
const navigation = useNavigation<WelcomeScreenNavigationProp>()
return (
<SafeAreaView style={$container}>
<ScrollView style={$container}>
<View style={$topContainer}>
<Image style={$welcomeLogo} source={welcomeLogo} resizeMode="contain" />
<Text testID="welcome-heading" style={$text} tx="welcomeScreen.title" preset="heading" />
<Text tx="welcomeScreen.subtitle" style={$welcomeSubheading} preset="subheading" />
<Text style={$text} tx="welcomeScreen.message" />
</View>
<View style={{ marginTop: spacing.lg }}>
<ListItem
text="Logging"
onPress={() => {
navigation.navigate("Logging")
}}
/>
<ListItem
text="Networking"
onPress={() => {
navigation.navigate("Networking")
}}
/>
<ListItem
text="Custom Commands"
onPress={() => {
navigation.navigate("CustomCommands")
}}
/>
<ListItem
text="Error Generators"
onPress={() => {
navigation.navigate("ErrorGenerator")
}}
/>
<ListItem
text="Benchmarking"
onPress={() => {
navigation.navigate("Benchmarking")
}}
/>
<ListItem
text="Async Storage"
onPress={() => {
navigation.navigate("AsyncStorage")
}}
/>
<ListItem
text="State Management: MST"
onPress={() => {
navigation.navigate("MobxStateTree")
}}
/>
<ListItem
text="State Management: Redux"
onPress={() => {
navigation.navigate("Redux")
}}
/>
<ListItem
text="Apollo Client"
onPress={() => {
navigation.navigate("Apollo")
}}
/>
</View>
</ScrollView>
</SafeAreaView>
)
}
const $container: ViewStyle = {
flex: 1,
backgroundColor: colors.background,
}
const $topContainer: ViewStyle = {
paddingHorizontal: spacing.lg,
}
const $welcomeLogo: ImageStyle = {
height: 88,
width: 88,
marginBottom: spacing.sm,
marginTop: spacing.xl,
}
const $text: TextStyle = {
color: colors.text,
}
const $welcomeSubheading: TextStyle = {
...$text,
marginBottom: spacing.sm,
}
const ListItem = (props: ListItemProps) => (
<ListItemParent
textStyle={$text}
containerStyle={{ marginHorizontal: spacing.lg }}
rightIcon="caretRight"
rightIconColor={colors.text}
topSeparator
{...props}
/>
)