[RN] 카카오지도, 카카오맵 가져오기

최예주·2023년 2월 18일
0

1. kakao developer에서 app key 받기

android는 키 해시
ios는 bundle Id
찾아서 설정해주세요

2. 인터넷 연결해주세요

android
AndroidManifest.xml에서
추가

ios
info.plist에서
https://magicofdream.tistory.com/17
따라하세요

3. .html 파일 만들어서 web에서 카카오맵 뜨는지 확인

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <meta
      name="description"
      content="Web site created using create-react-app"
    />

    <title>KakaoMaps</title>

    <script
      type="text/javascript"
      src="https://dapi.kakao.com/v2/maps/sdk.js?appkey=javascript key 가져오시면 됩니다"
    ></script>

    <script>
      document.addEventListener("DOMContentLoaded", function () {
        const mapContainer = document.getElementById("map");
        console.log(kakao.maps.Coords.Xb.La)
        const mapOption = {
          center: new kakao.maps.LatLng(33.450705, 126.570667),
          level: 3,
        };
        const map = new kakao.maps.Map(mapContainer, mapOption);
      });
    </script>

    <style>
      body {
        margin: 0;
        padding: 0;
      }
      #map {
        width: 100%;
        height: 100vh;
        margin: 0; padding: 0;
      }  
    </style>

  </head>
  <body>
    <div id="map">Hi</div>
  </body>
</html>

4. webview로 .html 파일 가져오기

<Webview
source={{ html: .html 파일 }}
/>

0개의 댓글