MCPcopy Create free account
hub / github.com/andrew-levy/jetpack-compose-react-native / GridsExample

Function GridsExample

example/app/grids.tsx:4–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2import { Grid } from "jetpack-compose-react-native";
3
4export default function GridsExample() {
5 return (
6 <ScrollView style={{ flex: 1 }} contentContainerStyle={{ padding: 20 }}>
7 <Text style={styles.header}>Grids Example</Text>
8 <Text style={[styles.header, { fontSize: 24 }]}>LazyVerticalGrid</Text>
9 {/* vertical grid it's by default */}
10 <Grid gridCellsType="fixed" size={5}>
11 {Array.from({ length: 50 }).map((_, index) => (
12 <Text key={index}>{index}</Text>
13 ))}
14 </Grid>
15
16 <Text style={[styles.header, { fontSize: 24 }]}>
17 LazyVerticalStaggeredGrid
18 </Text>
19 {/* vertical staggered grid it's by default */}
20 <Grid staggered spacedBy={5}>
21 {Array.from({ length: 30 }).map((_, index) => (
22 <Text key={index}>{index}</Text>
23 ))}
24 </Grid>
25
26 <Text style={[styles.header, { fontSize: 24 }]}>LazyHorizontalGrid</Text>
27 <Grid horizontal gridCellsType="adaptive">
28 {Array.from({ length: 30 }).map((_, index) => (
29 <Text key={index}>{index}</Text>
30 ))}
31 </Grid>
32
33 <Text style={[styles.header, { fontSize: 24 }]}>
34 LazyHorizontalStaggeredGrid
35 </Text>
36 <Grid horizontal staggered spacedBy={5} style={{ height: 150 }}>
37 {Array.from({ length: 30 }).map((_, index) => (
38 <Text key={index}>{index}</Text>
39 ))}
40 </Grid>
41 </ScrollView>
42 );
43}
44
45const styles = StyleSheet.create({
46 header: {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected