From c0eb4282218ea29fbca73a3cb03af94e0202954d Mon Sep 17 00:00:00 2001 From: Irul24 Date: Fri, 28 Feb 2025 17:00:25 +0700 Subject: [PATCH] screen --- src/component/mapCollectScreen.tsx | 102 ++++++++++++++++++++++++----- urlConfig.tsx | 3 +- 2 files changed, 86 insertions(+), 19 deletions(-) diff --git a/src/component/mapCollectScreen.tsx b/src/component/mapCollectScreen.tsx index e883b5a..74a4140 100644 --- a/src/component/mapCollectScreen.tsx +++ b/src/component/mapCollectScreen.tsx @@ -1,6 +1,6 @@ import React, {useState, useEffect, useRef} from "react"; import { View, Text, StyleSheet, Alert, TouchableOpacity, Image, Pressable, FlatList, LogBox, StatusBar, TextInput } from "react-native"; - +import CheckBox from '@react-native-community/checkbox'; import MapLibreGL from '@maplibre/maplibre-react-native'; import { MapView,ShapeSource,Camera,UserLocation,PointAnnotation,FillLayer,LineLayer,VectorSource } from "@maplibre/maplibre-react-native"; import Geolocation from "@react-native-community/geolocation"; @@ -8,6 +8,8 @@ import AsyncStorage from '@react-native-async-storage/async-storage'; // import { TextInput } from "react-native-paper"; import adminCountry from '../../assets/geojson/admKabKota.json'; import Modal from "react-native-modal"; +import RNFetchBlob from 'rn-fetch-blob'; +import { Ngrok_URL } from "../../urlConfig"; // MapLibreGL.setAccessToken(null); type MapCollectProps = {route: any,navigation: any} @@ -25,6 +27,9 @@ function MapCollectScreen({route,navigation}:MapCollectProps):React.JSX.Element{ const [modalInputLocation, setmodalInputLocation] = useState(false); const [modalBasemap, setmodalBasemap] = useState(false); const [modalLayerList, setmodalLayerList] = useState(false); + const [isSelectedLayer1, setSelectionLayer1] = useState(false); + const [layerList,setLayerList] = useState('') + const getLocation = () => { Geolocation.getCurrentPosition( position => { @@ -40,10 +45,31 @@ function MapCollectScreen({route,navigation}:MapCollectProps):React.JSX.Element{ {enableHighAccuracy: false, timeout: 15000, maximumAge: 10000}, ); }; + + const getLayerList = async() => { + try { + await RNFetchBlob.config({ + trusty : true + }) + .fetch('GET', `https://c557-117-102-73-102.ngrok-free.app/catalog`,{ + "Accept": 'application/json', + "Content-Type": "application/json", + } + ) + .then(async (resp) => { + const json = resp.json() + for (let key in json.tiles) { + console.log(`${key}:`); + } + }) + } catch (error) { + + } + } useEffect(()=> { - + getLayerList() getLocation() const timeoutId = setTimeout(()=> { @@ -124,27 +150,57 @@ function MapCollectScreen({route,navigation}:MapCollectProps):React.JSX.Element{ zoomEnabled={true} compassEnabled={false} > - {/* { - const props = e.features[0].properties - Alert.alert(props.NAME_2) - - } - } + console.log(e.features[0].properties?.nama); + Alert.alert(e.features[0].properties?.nama) + + }} > - + {/* {isSelectedLayer1 ? + + : + null + } */} + + { + console.log(e.features[0].properties?.company_name); + // Alert.alert(e.features[0].properties?.nama) + + }} + > - */} + {/* */} + {/* {isSelectedLayer1 ? + + : + null + } */} + {!delayRender ? <> + + + Administrasi Kecamatan Jakut + setSelectionLayer1(newValue)} + /> + + diff --git a/urlConfig.tsx b/urlConfig.tsx index 8853e0c..314f172 100644 --- a/urlConfig.tsx +++ b/urlConfig.tsx @@ -1,4 +1,5 @@ export const PJU_API_URL = 'https://apimobile.gisportal.id/api/v1/pju'; export const USER_API_URL = 'https://apimobile.gisportal.id/api/v1/user'; export const PDAM_API_URL = 'https://apimobile.gisportal.id/api/v1/pdam'; -export const PERMIT_API_URL = 'https://apimobile.gisportal.id/api/v1/permit'; \ No newline at end of file +export const PERMIT_API_URL = 'https://apimobile.gisportal.id/api/v1/permit'; +export const Ngrok_URL = 'https://c557-117-102-73-102.ngrok-free.app/'; \ No newline at end of file