Capacitor Native Map
@capgo/capacitor-네이티브 맵 장치 API 오픈 소스

네이티브 맵 Capacitor 플러그인

안드로이드의 Google Maps, iOS의 Apple MapKit, 웹의 Google Maps JS와 마커, 카메라, 오버레이를 위한 하나의 API

설치

bun add @capgo/capacitor-native-map bunx cap sync
npm, pnpm 또는 yarn
  • npm install @capgo/capacitor-native-map
  • pnpm add @capgo/capacitor-native-map
  • yarn add @capgo/capacitor-native-map

설명서

Capacitor에서 Native Map 사용 방법

capgo/capacitor-native-map를 사용하는 방법

Android에서 Google Maps, iOS에서 Apple MapKit, 웹에서 Google Maps JS와 마커, 카메라, 도형, 클러스터링, 이벤트를 위한 하나의 타입스크립트 API

설치

bun add @capgo/capacitor-native-map
bunx cap sync

이 플러그인이 노출하는 것

  • create: DOM 요소 내부에 임베디드 맵, 또는 toBack: true : 투명한 HTML 뒤에 맵
  • updateLayout: native map 크기 조절 및 위치 재배치 (CSS 픽셀).
  • setCamera / fitBounds: 카메라 및 뷰포트 제어.
  • addMarker / addMarkers / removeMarker: 마커에 탭 및 드래그 리스너.
  • enableClustering: 밀집한 마커 집합 그룹화.
  • enableCurrentLocation: 사용자 위치 점이 권한이 허용될 때.
  • Overlay: 다각형, 다중 선, 원, 및 타일 레이어 (플랫폼에 따라 다름).

예제 사용

임베디드 맵

import { NativeMap } from '@capgo/capacitor-native-map';

const map = await NativeMap.create({
  id: 'main-map',
  element: document.getElementById('map')!,
  apiKey: 'YOUR_GOOGLE_MAPS_API_KEY',
  config: {
    center: { lat: 37.7749, lng: -122.4194 },
    zoom: 12,
  },
});

map.setOnMapClickListener((e) => console.log(e.latitude, e.longitude));

// In a framework component, call `await map.destroy()` from your teardown/cleanup hook.

HTML UI와 함께 배경 맵

const map = await NativeMap.create({
  id: 'stores-map',
  toBack: true,
  apiKey: 'YOUR_GOOGLE_MAPS_API_KEY',
  config: {
    center: { lat: 40.7128, lng: -74.006 },
    zoom: 11,
    x: 0,
    y: 0,
    width: window.innerWidth,
    height: window.innerHeight,
  },
});

await map.updateLayout({
  x: 0,
  y: 0,
  width: window.innerWidth,
  height: window.innerHeight,
});

HUD 섹션을.wrap data-map-overlay (시작하는 방법 참조) Overlay CSS가 탭을 활성화하도록 하며 투명한 영역은 맵에 대한 터치 이벤트를 전달합니다.

전체 참조

FAQ

네이티브 맵 플러그인 FAQ

Native Map 플러그인을 Capacitor 앱에 설치하는 방법은 무엇입니까?

Run "bun add @capgo/capacitor-native-map" (or "npm install @capgo/capacitor-native-map"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-native-map" in your app code.

@capgo/capacitor-native-map은 React, Vue 및 Angular과 함께 작동합니까?

@Capacitor/Capacitor-native-map은 React, Vue 및 Angular과 호환되나요?

Which Capacitor version does @capgo/capacitor-native-map support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

capgo는 capacitor-native-map 무료이며 오픈 소스인가?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-native-map/ and the package is free to install from npm. Bug reports and pull requests are welcome.

네, 네이티브 맵을 사용하는 code를 앱 스토어 리뷰 없이 업데이트할 수 있나요?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

앱 리뷰 기다리지 않고 Native Map 변경을 배포하세요

스토어 빌드에 플러그인을 추가한 후 Capgo에서 라이브 업데이트를 사용하면, 사용자에게 몇 분 만에 자바스크립트, HTML 및 CSS 변경 사항을 푸시할 수 있습니다.

Capgo로 시작하세요