-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPropertyCard.tsx
61 lines (55 loc) · 1.35 KB
/
PropertyCard.tsx
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import React from 'react';
import { Button, StyleSheet, Text, View } from "react-native";
interface propertyCardProps {
isLandLord: boolean,
property: Object
navigation: any,
removeProperty: any,
key: number
}
const PropertyCard: React.FC<propertyCardProps> = ({ isLandLord, property, navigation, removeProperty, key }) => {
const styles = createStyles();
const btnText = isLandLord ? 'View Property' : 'Apply Now'
return (
<View style={styles.card}>
<Text style={styles.h1}>{property.name}</Text>
<Text style={styles.p}>{property.address}</Text>
<Text style={styles.p}>{'$' + property.price}</Text>
{isLandLord &&
<Button
onPress={() => {
navigation.navigate('RentalAppInfo', {property: property, isLandLord: isLandLord})
}}
title={btnText}
/>
}
{!isLandLord &&
<Button
onPress={() => {
navigation.navigate('SubmitApplication', {property: property, removeProperty: removeProperty, key: key})
}}
title={btnText}
/>
}
</View>
)
}
const createStyles = () => {
return StyleSheet.create({
card: {
backgroundColor: '#fff',
borderRadius: 5,
padding: 20,
marginBottom: 20,
},
h1: {
fontSize: 18,
color: '#000',
},
p: {
fontSize: 12,
color: '#000',
}
})
}
export default PropertyCard;