import React, {useEffect, useState} from 'react'; import {View, StyleSheet, Keyboard} from 'react-native'; import MapView, {Marker, PROVIDER_GOOGLE} from 'react-native-maps'; import {url} from '../url'; import Button from './Button'; import Search from './Search'; import {BLACK, PRIMERY, RED, WHITE} from '../color'; export default function Map({ lat, long, showsUserLocation, latDelta, longDelta, children, }) { const [actionLocation, setActionLocation] = useState(); const sendPostRequest = async () => { try { const response = await fetch(`${url}/action/action_display`, { method: 'GET', headers: { 'Content-Type': 'application/json', }, }); if (response.ok) { const data = await response.json(); console.log('data', data); setActionLocation( data.report.map(item => { return { latitude: item[0], longitude: item[1], }; }), ); } else { console.error('Server returned an error.', error); } } catch (error) { console.error('An error occurred:', error); } }; return ( {children} {actionLocation && actionLocation.length > 0 && actionLocation.map((loc, index) => ( ))}