forked from cemaden-educacao/WPD-MobileApp
GabrielTrettel
4 years ago
6 changed files with 4415 additions and 143 deletions
-
90src/app/components/MapMarker.js
-
1src/app/config/colors.js
-
5src/app/config/dimensions.js
-
6src/app/hooks/selectFromDB.js
-
3src/package.json
-
4453src/yarn.lock
@ -1,27 +1,95 @@ |
|||||
import React from "react"; |
|
||||
import { View, StyleSheet, Image } from "react-native"; |
|
||||
import MapView from "react-native-maps"; |
|
||||
|
|
||||
|
import React, { useState } from "react"; |
||||
|
import { View, StyleSheet, Image, Text } from "react-native"; |
||||
|
import MapView, { Callout } from "react-native-maps"; |
||||
|
import colors from "../config/colors"; |
||||
|
import assets from "../config/assets"; |
||||
|
import { dimensions, screen_height, screen_width } from "../config/dimensions"; |
||||
|
import { Svg, Image as ImageSvg } from "react-native-svg"; |
||||
const markerSize = 30; |
const markerSize = 30; |
||||
|
|
||||
export default function MapMarker({ title, image, coordinate, ...props }) { |
|
||||
// console.log({ title, image, coordinate, ...props });
|
|
||||
|
export default function MapMarker({ |
||||
|
title, |
||||
|
image, |
||||
|
pictures, |
||||
|
coordinate, |
||||
|
description, |
||||
|
...props |
||||
|
}) { |
||||
|
console.log(pictures); |
||||
|
const pictures_s = JSON.parse(pictures); |
||||
return ( |
return ( |
||||
<MapView.Marker coordinate={coordinate} title={title} {...props}> |
|
||||
|
<MapView.Marker coordinate={coordinate} {...props}> |
||||
|
<View> |
||||
|
<Image style={styles.markerPoint} resizeMode="stretch" source={image} /> |
||||
|
</View> |
||||
|
<Callout tooltip style={{ width: 250 }}> |
||||
<View> |
<View> |
||||
<Image style={styles.markerPoint} source={image} resizeMode="stretch" /> |
|
||||
|
<View style={styles.container}> |
||||
|
<Text style={styles.title}>{title}</Text> |
||||
|
<Text style={styles.description}>{description}</Text> |
||||
|
</View> |
||||
|
<View style={styles.arrow}></View> |
||||
</View> |
</View> |
||||
|
</Callout> |
||||
</MapView.Marker> |
</MapView.Marker> |
||||
); |
); |
||||
} |
} |
||||
|
|
||||
const styles = StyleSheet.create({ |
const styles = StyleSheet.create({ |
||||
|
title: { |
||||
|
fontWeight: "bold", |
||||
|
fontSize: dimensions.text.secondary, |
||||
|
alignSelf: "center", |
||||
|
paddingBottom: dimensions.spacing.minimal_padding, |
||||
|
}, |
||||
|
description: { |
||||
|
fontSize: dimensions.text.default, |
||||
|
}, |
||||
|
arrow: { |
||||
|
alignSelf: "center", |
||||
|
borderTopWidth: 15, |
||||
|
borderRightWidth: 10, |
||||
|
borderBottomWidth: 0, |
||||
|
borderLeftWidth: 10, |
||||
|
borderTopColor: colors.lightGray, |
||||
|
borderRightColor: "transparent", |
||||
|
borderBottomColor: "transparent", |
||||
|
borderLeftColor: "transparent", |
||||
|
paddingBottom: 5, |
||||
|
}, |
||||
|
|
||||
|
container: { |
||||
|
flexDirection: "column", |
||||
|
alignSelf: "center", |
||||
|
backgroundColor: colors.lightestGray, |
||||
|
borderColor: colors.lightGray, |
||||
|
borderRadius: 6, |
||||
|
borderWidth: 4, |
||||
|
borderTopWidth: 2, |
||||
|
padding: dimensions.spacing.minimal_padding, |
||||
|
width: 200, |
||||
|
}, |
||||
markerPoint: { |
markerPoint: { |
||||
alignSelf: "center", |
alignSelf: "center", |
||||
height: markerSize, |
height: markerSize, |
||||
width: markerSize, |
width: markerSize, |
||||
}, |
}, |
||||
title: { |
|
||||
fontWeight: "400", |
|
||||
}, |
|
||||
}); |
}); |
||||
|
|
||||
|
/* |
||||
|
* NOTE: Code for displaying images inside MapMarker. Leaved here for possible |
||||
|
* future needs |
||||
|
* |
||||
|
* |
||||
|
* {pictures_s.length > 0 && ( |
||||
|
* <Svg width={240} height={120}> |
||||
|
* <ImageSvg |
||||
|
* width={"100%"} |
||||
|
* height={"100%"} |
||||
|
* preserveAspectRatio="xMidYMid stretch" |
||||
|
* href={{ uri: pictures_s[0] }} |
||||
|
* /> |
||||
|
* </Svg> |
||||
|
* )} |
||||
|
* |
||||
|
*/ |
4453
src/yarn.lock
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Write
Preview
Loading…
Cancel
Save
Reference in new issue