Open History to see the last commit
1import * as React from 'react'
2import { View, StyleSheet } from 'react-native'
3import { Paragraph, TouchableRipple } from 'react-native-paper'
4import { MovieDetails } from '../lib/api'
5β
6type Props = {
7 item: MovieDetails
8 onPress: (item: MovieDetails) => 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 <Paragraph style={styles.title}>{item.title}</Paragraph>
17 </View>
18 <View style={styles.secondRow}>
19 <Paragraph>{item.year}</Paragraph>
20 </View>
21 </View>
22 </TouchableRipple>
23 )
24}
25β
26const styles = StyleSheet.create({
27 item: {
28 paddingRight: 10,
29 paddingLeft: 30,
30 paddingTop: 20,
31 paddingBottom: 10,
32 marginBottom: 10,
33 },
34 firstRow: {
35 marginTop: 5,
36 marginBottom: 5,
37 },
38 secondRow: {
39 marginBottom: 10,
40 },
41 title: { fontWeight: 'bold' },
42})