import { StyleSheet } from 'react-native' import MapLibreGL, { Camera, FillLayer, LineLayer, MapView, PointAnnotation, RasterLayer, RasterSource, ShapeSource, UserLocation } from '@maplibre/maplibre-react-native' import { FontAwesome5, MaterialIcons } from '@expo/vector-icons' import { circle } from '@turf/circle' import { useLastOwnLocation, useLastPlayerLocations } from '@/hooks/useLocation' import { useMemo, useState } from 'react' import { PlayerLocation } from '@/utils/features/location/locationSlice' import { useGame } from '@/hooks/useGame' import { FAB } from 'react-native-paper' export default function Map() { const [followUser, setFollowUser] = useState(true) return ( <> } onPress={() => setFollowUser(followUser => !followUser)} /> ) } function MapComponent({ followUser }: { followUser?: boolean }) { MapLibreGL.setAccessToken(null) const userLocation = useLastOwnLocation() return ( {userLocation && } ) } function PlayerLocationsMarkers() { const game = useGame() const lastPlayerLocations = useLastPlayerLocations() return lastPlayerLocations ? lastPlayerLocations .filter(playerLoc => playerLoc.playerId !== game.playerId) .map(playerLoc => ) : <> } function PlayerLocationMarker({ playerLocation }: { playerLocation: PlayerLocation }) { const accuracyCircle = useMemo(() => circle([playerLocation.longitude, playerLocation.latitude], playerLocation.accuracy, {steps: 64, units: 'meters'}), [playerLocation]) return <> } const styles = StyleSheet.create({ map: { flex: 1, alignSelf: 'stretch', } })