npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-naver-map

v0.0.23

Published

React NaverMap Component

Downloads

26

Readme

react-naver-map

React NaverMap Component

NPM

네이버 지도 자바스크립트 v3을 감싼 리액트 컴포넌트 입니다.

0.0.21 버전부터 Marker, Polyline, Polygon에서 id를 받지 않습니다. 또한 onClick에서도 id를 더이상 리턴하지 않습니다.

Install

npm install --save react-naver-map

Usage

Display map

import NaverMap from 'react-naver-map'

...

render() {
  return (
    <NaverMap
      clientId='...'
      ncp // 네이버 클라우드 플랫폼 사용여부
      style={{width:'500px', height:'500px'}}
      initialPosition={{lat:37.3595704, lng:127.105399}}
      initialZoom={8}
      initialBounds={{   // When you provide initialBounds, it will ignores initialPosition and initialZoom
        south:35.9732265, west:129.2055044, 
        north:36.1130996, east:129.4883056
      }}
      onInit={(map, naver) => {...}}  // map: naver map object, naver: window.naver object
      onBoundChange={(bounds) => {...}}  // bounds: naver.maps.LatLngBounds
      onMapClick={(event) => {...}}  // event: PointerEvent 
      submodules={['drawing','geocoder']} 
    />
  )
}

Display markers

import NaverMap, {Marker} from 'react-naver-map'
import markerPng from './marker.png'

...

render() {
  return (
    <NaverMap>
      {markers.map(marker => (
        <Marker 
          key={...} 
          lat={marker.lat} 
          lng={marker.lng}
          onClick={event => {...}}  // id: given id, event: PointerEvent 
          icon={{
            url: markerPng,
            size:{width:24,height:32},
            scaledSize:{width:24,height:32},
            anchor: {x:12, y:32}
          }}
          shape={{coords: [0,12, 12,0, 24,12, 12,32, 0,12], type: 'poly'}}  // click mask shape
        />
      ))}
    </NaverMap>
  )
}

Display polyline and ploygon

import NaverMap from 'react-naver-map'

...

render() {
  return (
    <NaverMap>
      <NaverMap.Polyline 
        path={[
          {lat:37.359924641705476, lng: 127.1148204803467},
          {lat:37.36343797188166, lng: 127.11486339569092},
          {lat:37.368520071054576, lng: 127.11473464965819},
          {lat:37.3685882848096, lng: 127.1088123321533},
        ]}
        strokeColor={'#f04da8'}
        strokeOpacity={0.7}
        strokeWeight={3}
      />
      <NaverMap.Polygon 
        paths={[
          [
            {lat: 37.37544345085402, lng: 127.11224555969238},
            {lat: 37.37230584065902, lng: 127.10791110992432},
            {lat: 37.35975408751081, lng: 127.10795402526855},
            {lat: 37.359924641705476, lng: 127.11576461791992},
            {lat: 37.35931064479073, lng: 127.12211608886719},
            {lat: 37.36043630196386, lng: 127.12293148040771},
            {lat: 37.36354029942161, lng: 127.12310314178465},
            {lat: 37.365211629488016, lng: 127.12456226348876},
            {lat: 37.37544345085402, lng: 127.1122455596923})
          ],
          [
            {lat: 37.368485964153784, lng: 127.10971355438232},
            {lat: 37.368520071054576, lng: 127.11464881896971},
            {lat: 37.36350619025713, lng: 127.11473464965819},
            {lat: 37.363403862670665, lng: 127.1097993850708},
            {lat: 37.368485964153784, lng: 127.1097135543823})
          ]
        ]} 
        fillColor={'#ff0000'}
        fillOpacity={0.3}
        strokeColor={'#ff0000'}
        strokeOpacity={0.6}
        strokeWeight={3}
      /> 
    </NaverMap>
  )
}

Display Overlay

import NaverMap, {Overlay} from 'react-naver-map'

...

render() {
  return (
    <NaverMap>
      <Overlay
        lat={37.3595704}
        lng={127.105399}
        zIndex={200}
        onClick={e => {
          console.log('overclick')
          e.stopPropagation()
        }}>
        <div
          style={{
            width: '120px',
            height: '120px',
            backgroundColor: 'white',
          }}>
          <img src={imgSrc} alt="overImg" style={{width: '100%', height: '100%'}} />
        </div>
      </Overlay>
    </NaverMap>
  )
}

License

MIT © seongmo