parent
78cdabb260
commit
0b07adff44
1 changed files with 47 additions and 45 deletions
@ -1,49 +1,51 @@ |
|||||||
// import React from "react";
|
import React from "react"; |
||||||
// import MapView, { Marker } from "react-native-maps";
|
import MapboxGL from '@react-native-mapbox-gl/maps'; |
||||||
|
|
||||||
// //assets
|
//assets
|
||||||
// import markerIcon from "../assets/icons/marker.png";
|
// import markerIcon from "../assets/icons/marker.png";
|
||||||
|
|
||||||
// export default function MapSelector({ setAddress }) {
|
MapboxGL.setAccessToken('<YOUR_ACCESSTOKEN>'); |
||||||
// const [markerCoordinates, setMarkerCoordinates] = React.useState({
|
|
||||||
// latitude: 35.7219,
|
|
||||||
// longitude: 51.3347,
|
|
||||||
// });
|
|
||||||
// const getLocation = (location) => {
|
|
||||||
// setMarkerCoordinates(location);
|
|
||||||
// try {
|
|
||||||
// fetch(
|
|
||||||
// `https://map.ir/reverse/no?lat=${location.latitude}&lon=${location.longitude}`,
|
|
||||||
// {
|
|
||||||
// headers: {
|
|
||||||
// "Content-Type": "application/json",
|
|
||||||
// "x-api-key":
|
|
||||||
// "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjkyODE4ODI0N2FhMjdlYTMyMzVlYzRiOWUxZDI3NTQyZTNjYmI3ZjQzY2Q2NGQzYjdkYjU1NmY3NDM5YzU2NzUyNzMxMjAzYzMwOTliYTFiIn0.eyJhdWQiOiIxNjk2MSIsImp0aSI6IjkyODE4ODI0N2FhMjdlYTMyMzVlYzRiOWUxZDI3NTQyZTNjYmI3ZjQzY2Q2NGQzYjdkYjU1NmY3NDM5YzU2NzUyNzMxMjAzYzMwOTliYTFiIiwiaWF0IjoxNjQ0MzE3MDA5LCJuYmYiOjE2NDQzMTcwMDksImV4cCI6MTY0NjgyMjYwOSwic3ViIjoiIiwic2NvcGVzIjpbImJhc2ljIl19.Gckmd77Vw-wmsaztsmVmjYmfp4zXRSy2f0tXS-1p7IY8VJmvCCrk64y7WvCLbH0YfGZI9rG9ZUi5hRJDDGXu70l1ZafCYq2-EkMzcbx-PGTTq2bHGNZujF4ur1xtGoXd2kwGuldiR_6SJdqYLHcupbscFI7hHaQnkN1xWJ-L8476ZOKzUgiBvwH9uElGZXwD6SwfXoGW_R38_isrnfTXKfW9PPixyLaN3404tcjOU1r02HIurrplXlIKRKG9CVXxKsESfJJ8trwtZw6O4erxrnisxfL0VwAR7l69P6KcFb57vvM4j4hKFqxUDr4YvSq1qOTt3urYbAKehhvoiLhZxw",
|
|
||||||
// },
|
|
||||||
// }
|
|
||||||
// )
|
|
||||||
// .then((response) => response.json())
|
|
||||||
// .then((data) => setAddress(data.address));
|
|
||||||
// } catch (err) {
|
|
||||||
// console.log(err);
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
// return (
|
|
||||||
// <MapView
|
export default function MapSelector({ setAddress }) { |
||||||
// initialRegion={{
|
// const [markerCoordinates, setMarkerCoordinates] = React.useState({
|
||||||
// latitude: 35.7219,
|
// latitude: 35.7219,
|
||||||
// longitude: 51.3347,
|
// longitude: 51.3347,
|
||||||
// latitudeDelta: 0.0922,
|
// });
|
||||||
// longitudeDelta: 0.0421,
|
|
||||||
// }}
|
// const getLocation = (location) => {
|
||||||
// style={{
|
// setMarkerCoordinates(location);
|
||||||
// width: "100%",
|
// try {
|
||||||
// height: "100%",
|
// fetch(
|
||||||
// }}
|
// `https://map.ir/reverse/no?lat=${location.latitude}&lon=${location.longitude}`,
|
||||||
// onPress={(e) => getLocation(e.nativeEvent.coordinate)}
|
// {
|
||||||
// >
|
// headers: {
|
||||||
// <Marker coordinate={markerCoordinates} image={markerIcon} />
|
// "Content-Type": "application/json",
|
||||||
// </MapView>
|
// "x-api-key":
|
||||||
// );
|
// "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjkyODE4ODI0N2FhMjdlYTMyMzVlYzRiOWUxZDI3NTQyZTNjYmI3ZjQzY2Q2NGQzYjdkYjU1NmY3NDM5YzU2NzUyNzMxMjAzYzMwOTliYTFiIn0.eyJhdWQiOiIxNjk2MSIsImp0aSI6IjkyODE4ODI0N2FhMjdlYTMyMzVlYzRiOWUxZDI3NTQyZTNjYmI3ZjQzY2Q2NGQzYjdkYjU1NmY3NDM5YzU2NzUyNzMxMjAzYzMwOTliYTFiIiwiaWF0IjoxNjQ0MzE3MDA5LCJuYmYiOjE2NDQzMTcwMDksImV4cCI6MTY0NjgyMjYwOSwic3ViIjoiIiwic2NvcGVzIjpbImJhc2ljIl19.Gckmd77Vw-wmsaztsmVmjYmfp4zXRSy2f0tXS-1p7IY8VJmvCCrk64y7WvCLbH0YfGZI9rG9ZUi5hRJDDGXu70l1ZafCYq2-EkMzcbx-PGTTq2bHGNZujF4ur1xtGoXd2kwGuldiR_6SJdqYLHcupbscFI7hHaQnkN1xWJ-L8476ZOKzUgiBvwH9uElGZXwD6SwfXoGW_R38_isrnfTXKfW9PPixyLaN3404tcjOU1r02HIurrplXlIKRKG9CVXxKsESfJJ8trwtZw6O4erxrnisxfL0VwAR7l69P6KcFb57vvM4j4hKFqxUDr4YvSq1qOTt3urYbAKehhvoiLhZxw",
|
||||||
// }
|
// },
|
||||||
|
// }
|
||||||
|
// )
|
||||||
|
// .then((response) => response.json())
|
||||||
|
// .then((data) => setAddress(data.address));
|
||||||
|
// } catch (err) {
|
||||||
|
// console.log(err);
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
|
const onRegionDidChange = (e) => { |
||||||
|
console.log('onRegionDidChange', e.geometry.coordinates); |
||||||
|
}; |
||||||
|
|
||||||
|
return ( |
||||||
|
<Mapir |
||||||
|
apiKey={ |
||||||
|
"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjkyODE4ODI0N2FhMjdlYTMyMzVlYzRiOWUxZDI3NTQyZTNjYmI3ZjQzY2Q2NGQzYjdkYjU1NmY3NDM5YzU2NzUyNzMxMjAzYzMwOTliYTFiIn0.eyJhdWQiOiIxNjk2MSIsImp0aSI6IjkyODE4ODI0N2FhMjdlYTMyMzVlYzRiOWUxZDI3NTQyZTNjYmI3ZjQzY2Q2NGQzYjdkYjU1NmY3NDM5YzU2NzUyNzMxMjAzYzMwOTliYTFiIiwiaWF0IjoxNjQ0MzE3MDA5LCJuYmYiOjE2NDQzMTcwMDksImV4cCI6MTY0NjgyMjYwOSwic3ViIjoiIiwic2NvcGVzIjpbImJhc2ljIl19.Gckmd77Vw-wmsaztsmVmjYmfp4zXRSy2f0tXS-1p7IY8VJmvCCrk64y7WvCLbH0YfGZI9rG9ZUi5hRJDDGXu70l1ZafCYq2-EkMzcbx-PGTTq2bHGNZujF4ur1xtGoXd2kwGuldiR_6SJdqYLHcupbscFI7hHaQnkN1xWJ-L8476ZOKzUgiBvwH9uElGZXwD6SwfXoGW_R38_isrnfTXKfW9PPixyLaN3404tcjOU1r02HIurrplXlIKRKG9CVXxKsESfJJ8trwtZw6O4erxrnisxfL0VwAR7l69P6KcFb57vvM4j4hKFqxUDr4YvSq1qOTt3urYbAKehhvoiLhZxw" |
||||||
|
} |
||||||
|
onRegionDidChange={(e) => onRegionDidChange(e)} |
||||||
|
style={{ flex : 1 }} |
||||||
|
> |
||||||
|
<Mapir.Camera zoomLevel={13} centerCoordinate={[51.422548, 35.732573]} /> |
||||||
|
</Mapir> |
||||||
|
); |
||||||
|
} |
||||||
|
Loading…
Reference in new issue