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