diff options
| author | Maksymilian Jopek <maks@jopek.eu> | 2023-04-01 17:44:58 +0200 |
|---|---|---|
| committer | Maksymilian Jopek <maks@jopek.eu> | 2023-04-01 17:51:16 +0200 |
| commit | eb25480919c73af5c02771c6124494f415f7a063 (patch) | |
| tree | 8ede26ac1764ce115894fa7b375d2a617bd9d33a /modules/Map.js | |
| parent | bb1eb5012dfee08024c0dbfe071af8c28f8cace6 (diff) | |
| download | geo-app-eb25480919c73af5c02771c6124494f415f7a063.tar.gz geo-app-eb25480919c73af5c02771c6124494f415f7a063.tar.zst geo-app-eb25480919c73af5c02771c6124494f415f7a063.zip | |
Diffstat (limited to 'modules/Map.js')
| -rw-r--r-- | modules/Map.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/modules/Map.js b/modules/Map.js new file mode 100644 index 0000000..a979424 --- /dev/null +++ b/modules/Map.js @@ -0,0 +1,49 @@ +import MapView, { Marker } from 'react-native-maps' +import * as React from 'react'; +import { View, Text, StyleSheet, TouchableOpacity } from 'react-native'; +import AsyncStorage from "@react-native-async-storage/async-storage"; + +const L_KEY = 'locs_key' + +export default function Home(props) { + const [markers, setMarkers] = React.useState([]) + const startFn = async () => { + setMarkers(JSON.parse(await AsyncStorage.getItem(L_KEY))) + }; + React.useEffect(() => {startFn()}, []) + return ( + <MapView + style={{ flex: 1 }} + initialRegion={{ + latitude: 49.9741841, + longitude: 20.1000589, + latitudeDelta: 0.001, + longitudeDelta: 0.001, + }} + > + {markers.filter(m => m.c).map(m => { + return <Marker + coordinate={{ + latitude: m.l.coords.latitude, + longitude: m.l.coords.longitude, + }} + title={""} + description={""} + key={m.l.timestamp} + /> + })} + </MapView> + ) +} + +const styles = StyleSheet.create({ + cont: { + flexDirection: "column", + marginTop: 10, + paddingTop: 10, + backgroundColor: "#3D54BB", + justifyContent: "center", + alignItems: "center", + height: "100%", + }, +}) |
