KickMarkerComponent.js
4.31 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import React from "react";
import {View, Text, Image} from "react-native";
import {Callout, Marker} from "react-native-maps";
import {useNavigation} from '@react-navigation/native';
import SquareButtonComponent from "./Base/SquareButtonComponent";
import {BUTTON_COLOR} from "../constant";
const KickMarkerComponent = (props) => {
const navigation = useNavigation();
// 데이터
const {markerImage, serviceNumber, nameOfService, infoOfService, kickLocationMarker, index, minIndex, servicePrice, getPath} = props;
// 함수
const goToMyPage = () => {
navigation.navigate('이킥저킥');
};
// 렌더링
return (
<Marker coordinate={{
latitude: parseFloat(kickLocationMarker.coordinate.latitude),
longitude: parseFloat(kickLocationMarker.coordinate.longitude),
}}
onPress={() => getPath(serviceNumber, {
title: kickLocationMarker.title,
coordinate: {
latitude: parseFloat(kickLocationMarker.coordinate.latitude),
longitude: parseFloat(kickLocationMarker.coordinate.longitude),
}
})}
opacity={index === minIndex ? 1.0 : 0.6}
>
{serviceNumber === 0
?
<Image source={require('../assets/gcooter.png')} style={{height: 35, width: 35, borderRadius: 50}}/>
:
serviceNumber === 1
?
<Image source={require('../assets/flower_road.png')}
style={{height: 35, width: 35, borderRadius: 50}}/>
:
<Image source={require('../assets/ssing_ssing.png')}
style={{height: 35, width: 35, borderRadius: 50}}/>
}
<Callout tooltip={true}
style={{width: 200}} onPress={goToMyPage}>
<View style={{backgroundColor: '#ffffff', paddingLeft: 10, paddingRight: 10, paddingTop: 10, paddingBottom: 5, borderRadius: 5}}>
<View style={{
backgroundColor: '#ebebeb',
padding: 5,
marginBottom: 10,
borderRadius: 5
}}>
<Text style={{
fontSize: 16,
color: '#373737',
fontWeight: 'bold',
textAlign: 'center'
}}>
{index === minIndex ? '가까운' : ''} {nameOfService}
</Text>
{index === minIndex
?
<Text style={{
fontSize: 16,
color: '#373737',
fontWeight: 'bold',
textAlign: 'center'
}}>
예상비용 {servicePrice}원
</Text>
:
<></>}
</View>
<Text style={{fontSize: 14, color: '#373737'}}>
남은 배터리 {kickLocationMarker.title}%
</Text>
<Text style={{fontSize: 14, color: '#373737'}}>
{infoOfService}
</Text>
<SquareButtonComponent
text={'대여하기'}
style1={{
marginLeft: 0,
marginRight: 0,
marginTop: 5,
marginBottom: 5,
padding: 5,
borderRadius: 3,
backgroundColor: BUTTON_COLOR
}}
style2={{
fontSize: 16,
fontWeight: 'bold',
textAlign: 'center',
color: '#ffffff'
}}
/>
</View>
</Callout>
</Marker>
);
};
export default KickMarkerComponent;