Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

ListItem.tsx

41 lines942 Bytes

1import * as React from 'react'
2import { View, StyleSheet } from 'react-native'
3import { Paragraph, TouchableRipple } from 'react-native-paper'
4​
5type Props = {
6 item: any
7 onPress: (item: any) => void
8}
9​
10export function ListItem({ item, onPress }: Props) {
11 return (
12 <TouchableRipple onPress={() => onPress(item)} accessibilityRole="button">
13 <View style={styles.item}>
14 <View style={styles.firstRow}>
15 <Paragraph style={styles.title}>{item.title}</Paragraph>
16 </View>
17 <View style={styles.secondRow}>
18 <Paragraph>{item.year}</Paragraph>
19 </View>
20 </View>
21 </TouchableRipple>
22 )
24​
25const styles = StyleSheet.create({
26 item: {
27 paddingRight: 10,
28 paddingLeft: 30,
29 paddingTop: 20,
30 paddingBottom: 10,
31 marginBottom: 10,
32 },
33 firstRow: {
34 marginTop: 5,
35 marginBottom: 5,
36 },
37 secondRow: {
38 marginBottom: 10,
39 },
40 title: { fontWeight: 'bold' },
41})