소개
Tiny (1kb less) but very powerful React Google Map
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalRGM
Tiny 1kb less but very powerful React Google Map.
It allows you to render any React component on the Google Map, and provides easy access to native google map api.
Example
import { Map, Overlay, Marker } from 'rgm';
...
<Map api={api} options={MAP_OPTIONS}>
<Overlay debug={debug}>
<Marker lat={lat} lng={lng}>
<ReactComponent />
</Marker>
</Overlay>
</Map>
Install
yarn add rgm
# or
npm install rgm
API
Map
Draws google map.
properties:
api non nullable value of window.google.maps
options see MapOptions or (elt:HTMLDivElement) => MapOptions where elt is map holder element.
ref exposes instance of google.maps.Map
Overlay
Creates overlay to place React components inside.
properties:
- debug to control React component placements in dev mode see example
Marker
Wrapper around your component to pass lat, lng into Overlay in a type safe way without touching props of your component.
properties:
- lat latitude
- lng longitude
useMap
hook to get access to instances of google.maps.Map and window.google.maps.
returns:
- { api, map } object, where api is equal to window.google.maps and map is instance of google.maps.Map
Types
Flowtype, Typescript.
For typescript usage you probably need to add @types/googlemaps into your project.
Contribute
Get your api key at Google
Then start dev environment.
GOOGLE_API_KEY=<YOUR GOOGLE API KEY> yarn dev
Why
Why another library having that one of current library authors is also creator of google-map-react
React map libraries along with the ability to draw react on a map are also trying to provide access to google map via declarative API. It needs a lot of hacks, code and opinionated decisions.
We created a library with ability to draw react components on a map providing minimal subset of properties needed to use native api or create any additional declarative api.
Soon will be 1 year as we are happy with it. Small amount of code makes it easy to support and extend.
관련 프로젝트 살펴보기
불러오는 중…