File size: 1,007 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import * as React from 'react'
import { StyleSheet, View } from 'react-native'
import { Paragraph, TouchableRipple } from 'react-native-paper'
import type { MovieDetails } from '../lib/api'

type Props = {
  item: MovieDetails
  onPress: (item: MovieDetails) => void
}

export function ListItem({ item, onPress }: Props) {
  return (
    <TouchableRipple onPress={() => onPress(item)} accessibilityRole="button">
      <View style={styles.item}>
        <View style={styles.firstRow}>
          <Paragraph style={styles.title}>{item.title}</Paragraph>
        </View>
        <View style={styles.secondRow}>
          <Paragraph>{item.year}</Paragraph>
        </View>
      </View>
    </TouchableRipple>
  )
}

const styles = StyleSheet.create({
  item: {
    paddingRight: 10,
    paddingLeft: 30,
    paddingTop: 20,
    paddingBottom: 10,
    marginBottom: 10,
  },
  firstRow: {
    marginTop: 5,
    marginBottom: 5,
  },
  secondRow: {
    marginBottom: 10,
  },
  title: { fontWeight: 'bold' },
})