-
Notifications
You must be signed in to change notification settings - Fork 388
Expand file tree
/
Copy pathExamplesScreen.tsx
More file actions
153 lines (143 loc) · 3.67 KB
/
Copy pathExamplesScreen.tsx
File metadata and controls
153 lines (143 loc) · 3.67 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
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
import React from "react";
import {
StatusBar,
StyleSheet,
FlatList,
Text,
Pressable,
View,
} from "react-native";
import { StackNavigationProp } from "@react-navigation/stack";
import { useNavigation } from "@react-navigation/native";
import { DebugButton } from "./Debug";
import { RootStackParamList } from "./constants";
interface ExampleItem {
title: string;
destination: keyof RootStackParamList;
}
export const ExamplesScreen = () => {
const { navigate } =
useNavigation<StackNavigationProp<RootStackParamList, "Examples">>();
const onDebugButton = () => {
navigate("Debug");
};
const data: ExampleItem[] = [
{ title: "Sticky Header Example", destination: "StickyHeaderExample" },
{ title: "Horizontal List", destination: "HorizontalList" },
{ title: "Carousel", destination: "Carousel" },
{ title: "Grid", destination: "Grid" },
{ title: "Masonry", destination: "Masonry" },
{ title: "Complex Masonry", destination: "ComplexMasonry" },
{
title: "Chat",
destination: "Chat",
},
{
title: "RecyclerView Handler Test",
destination: "RecyclerViewHandlerTest",
},
{
title: "Contacts",
destination: "Contacts",
},
{
title: "Contacts SectionList",
destination: "ContactsSectionList",
},
{ title: "SectionList", destination: "SectionList" },
{ title: "PaginatedList", destination: "PaginatedList" },
{ title: "Twitter Timeline", destination: "Twitter" },
{
title: "Twitter FlatList Timeline",
destination: "TwitterFlatList",
},
{
title: "Twitter Benchmark",
destination: "TwitterBenchmark",
},
{ title: "List", destination: "List" },
{ title: "Reminders", destination: "Reminders" },
{
title: "Dynamic Items",
destination: "DynamicItems",
},
{
title: "Messages",
destination: "Messages",
},
{
title: "Messages FlatList",
destination: "MessagesFlatList",
},
{
title: "CellRenderer Examples",
destination: "CellRendererExamples",
},
{
title: "Header Footer Empty Example",
destination: "HeaderFooterExample",
},
{
title: "Movie Streaming",
destination: "MovieList",
},
{
title: "Layout Options",
destination: "LayoutOptions",
},
{ title: "Dynamic Column Span", destination: "DynamicColumnSpan" },
{
title: "Showcase App",
destination: "ShowcaseApp",
},
{
title: "Lot of Items",
destination: "LotOfItems",
},
{
title: "Manual FlashList Benchmark Example",
destination: "ManualBenchmarkExample",
},
{
title: "Manual FlatList Benchmark Example",
destination: "ManualFlatListBenchmarkExample",
},
];
return (
<>
<StatusBar barStyle="dark-content" />
<FlatList
testID="ExamplesFlatList"
keyExtractor={(item) => item.destination}
data={data}
removeClippedSubviews={false}
renderItem={({ item }) => (
<Pressable
style={styles.row}
onPress={() => {
navigate(item.destination as any);
}}
testID={item.title}
>
<Text style={styles.rowTitle}>{item.title}</Text>
</Pressable>
)}
ListFooterComponent={<View style={{ height: 100 }} />}
/>
<DebugButton onPress={onDebugButton} />
</>
);
};
const styles = StyleSheet.create({
row: {
padding: 16,
backgroundColor: "#FFF",
borderBottomWidth: 1,
borderBottomColor: "#EFEFEF",
flexDirection: "row",
justifyContent: "space-between",
},
rowTitle: {
fontSize: 18,
},
});