Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/quadflask/react-native-naver-map
๐บ๏ธnaver map for react-native
https://github.com/quadflask/react-native-naver-map
naver-map react-native
Last synced: about 3 hours ago
JSON representation
๐บ๏ธnaver map for react-native
- Host: GitHub
- URL: https://github.com/quadflask/react-native-naver-map
- Owner: QuadFlask
- License: mit
- Created: 2019-05-02T04:15:29.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-07-08T07:58:22.000Z (4 months ago)
- Last Synced: 2024-10-14T02:26:55.955Z (about 1 month ago)
- Topics: naver-map, react-native
- Language: Java
- Homepage:
- Size: 4.1 MB
- Stars: 163
- Watchers: 10
- Forks: 149
- Open Issues: 92
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
react-native-naver-map [![npm version](https://badge.fury.io/js/react-native-nmap.svg)](https://badge.fury.io/js/react-native-nmap)
-----๋ค์ด๋ฒ๋งต์ ๋ฆฌ์กํธ ๋ค์ดํฐ๋ธ ๋ธ๋ฆฟ์ง์ ๋๋ค.
![](https://raw.githubusercontent.com/QuadFlask/react-native-naver-map/master/example/screenshot/screenshot.png)
## ์ค์น
```
npm install react-native-nmap --save;
```- **React Native 0.60+**
```bash
$ cd ios/ && pod install
```- **React Native <= 0.59**
```bash
$ react-native link react-native-nmap
$ cd ios/ && pod install
```> ios์ ๊ฒฝ์ฐ `git-lfs` ์ค์น๊ฐ ํ์ํฉ๋๋ค. [์ฐธ๊ณ ](https://github.com/navermaps/ios-map-sdk#%EB%8C%80%EC%9A%A9%EB%9F%89-%ED%8C%8C%EC%9D%BC%EC%9D%84-%EB%B0%9B%EA%B8%B0-%EC%9C%84%ED%95%B4-git-lfs-%EC%84%A4%EC%B9%98%EA%B0%80-%ED%95%84%EC%9A%94%ED%95%A9%EB%8B%88%EB%8B%A4)
### ์๋๋ก์ด๋ ์ถ๊ฐ ์ค์
[๋ค์ด๋ฒ ๋งต ์๋๋ก์ด๋ SDK ๋ฌธ์](https://navermaps.github.io/android-map-sdk/guide-ko/1.html)๋ฅผ ๋ฐ๋ผ APIํค์ ๋ ํฌ์งํฐ๋ฆฌ ๊ฒฝ๋ก๋ฅผ ์ถ๊ฐํฉ๋๋ค
`/android/build.gradle` ํ์ผ์ ์๋์ ๊ฐ์ด ๋ ํฌ์งํฐ๋ฆฌ๋ฅผ ์ถ๊ฐํฉ๋๋ค
> โ ๏ธ Bintray ์ง์ ์ค๋จ์ ์ํด jfrog๋ก ์์ ๋์์ต๋๋ค
```
allprojects {
repositories {
google()
jcenter()
// ๋ค์ด๋ฒ ์ง๋ ์ ์ฅ์
maven {
url 'https://naver.jfrog.io/artifactory/maven/'
}
}
}
````/android/app/src/AndroidManifest.xml`์ ์๋์ ๊ฐ์ด ์ถ๊ฐํ๊ณ ๋ฐ๊ธ๋ฐ์ ํด๋ผ์ด์ธํธ ์์ด๋๋ก ๋ฐ๊ฟ์ค๋๋ค.
```xml
```
### IOS ์ถ๊ฐ ์ค์
[๋ค์ด๋ฒ ๋งต IOS SDK ๋ฌธ์](https://navermaps.github.io/ios-map-sdk/guide-ko/1.html)๋ฅผ ๋ฐ๋ผ APIํค์ ๋ ํฌ์งํฐ๋ฆฌ ๊ฒฝ๋ก๋ฅผ ์ถ๊ฐํฉ๋๋ค.
`info.plist`์ ์๋์ ๊ฐ์ด ๋ฐ๊ธ๋ฐ์ ํด๋ผ์ด์ธํธ ์์ด๋๋ฅผ ์ถ๊ฐํด์ค๋๋ค.
![image](https://user-images.githubusercontent.com/49827449/66392740-b2fd5f00-ea0b-11e9-8c38-23e604b1009d.png)
```xml
...
NMFClientId
YOUR_CLIENT_ID_HERE
...```
## ์์
> [example/App.js](https://github.com/QuadFlask/react-native-naver-map/blob/master/example/App.js)
```tsx
import NaverMapView, {Circle, Marker, Path, Polyline, Polygon} from "react-native-nmap";function MyMap() {
const P0 = {latitude: 37.564362, longitude: 126.977011};
const P1 = {latitude: 37.565051, longitude: 126.978567};
const P2 = {latitude: 37.565383, longitude: 126.976292};return console.warn('onTouch', JSON.stringify(e.nativeEvent))}
onCameraChange={e => console.warn('onCameraChange', JSON.stringify(e))}
onMapClick={e => console.warn('onMapClick', JSON.stringify(e))}>
console.warn('onClick! p0')}/>
console.warn('onClick! p1')}/>
console.warn('onClick! p2')}/>
console.warn('onClick! path')} width={10}/>
console.warn('onClick! polyline')}/>
console.warn('onClick! circle')}/>
console.warn('onClick! polygon')}/>
}
```## ์ปดํฌ๋ํธ
ํ์ ์คํฌ๋ฆฝํธ ํ์ ์ ์๊ฐ ํฌํจ๋์ด ์์ด ํ์ ์คํฌ๋ฆฝํธ ์ฌ์ฉ์ ์ถ์ฒํฉ๋๋ค.
### ๊ธฐ๋ณธ ํ์
```ts
export interface Coord {
latitude: number;
longitude: number;
}
export interface Region extends Coord {
latitudeDelta: number;
longitudeDelta: number;
}
export interface Rect {
left?: number;
top?: number;
right?: number;
bottom?: number;
}
```### `NaverMapView`
```ts
interface NaverMapViewProps {
center?: Coord & {
zoom?: number;
tilt?: number;
bearing?: number;
};
tilt?: number;
bearing?: number;
mapPadding?: Rect;
logoMargin?: Rect;
logoGravity?: Gravity;
onInitialized?: Function;
onCameraChange?: (event: {
latitude: number;
longitude: number;
zoom: number;
contentsRegion: [Coord, Coord, Coord, Coord, Coord]; // https://navermaps.github.io/android-map-sdk/reference/com/naver/maps/map/NaverMap.html#getContentRegion()
coveringRegion: [Coord, Coord, Coord, Coord, Coord];
}) => void;
onMapClick?: (event: {
x: number;
y: number;
latitude: number;
longitude: number;
}) => void;
onTouch?: () => void;
showsMyLocationButton?: boolean;
compass?: boolean;
scaleBar?: boolean;
zoomControl?: boolean;
mapType?: MapType;
minZoomLevel?: number;
maxZoomLevel?: number;
buildingHeight?: number;
nightMode?: boolean;
scrollGesturesEnabled?: boolean;
zoomGesturesEnabled?: boolean;
tiltGesturesEnabled?: boolean;
rotateGesturesEnabled?: boolean;
stopGesturesEnabled?: boolean;
useTextureView?: boolean; // android only
}
/// component method
animateToCoordinate: (coord: Coord) => void;
animateToTwoCoordinates: (c1: Coord, c2: Coord) => void;
animateToCoordinates: (coords: Coord[], bounds?: {
top: number;
bottom: number;
left: number;
right: number;
}) => void;
animateToRegion: (region: Region) => void;
setLocationTrackingMode: (mode: number) => void;
setLayerGroupEnabled: (group: LayerGroup, enabled: boolean) => void;
showsMyLocationButton: (show: boolean) => void;
handleOnCameraChange: (event: React.SyntheticEvent<{}, {
latitude: number;
longitude: number;
zoom: number;
}>) => void;
handleOnMapClick: (event: React.SyntheticEvent<{}, {
x: number;
y: number;
latitude: number;
longitude: number;
}>) => void;
```### `Marker`
```ts
interface MarkerProps {
coordinate: Coord
anchor?: { x: number, y: number }
pinColor?: string
alpha?: number
rotation?: number
flat?: boolean
image?: ImageSourcePropType
onClick?: () => void
width?: number
height?: number
angle?: number
hidden?: boolean
zIndex?: number
iconPerspectiveEnabled?: boolean
isHideCollidedSymbols?: boolean
isHideCollidedMarkers?: boolean
isHideCollidedCaptions?: boolean;
isForceShowIcon?: boolean;
caption?: {
text?: string;
align?: Align;
textSize?: number;
color?: string;
haloColor?: string;
offset?: number;
requestedWidth?: number;
minZoom?: number;
maxZoom?: number;
};
subCaption?: {
text?: string;
textSize?: number;
color?: number;
haloColor?: number;
requestedWidth?: number;
minZoom?: number;
maxZoom?: number;
};
}
```
> ์๋๋ก์ด๋ ํ๋ซํผ์์ ๋ง์ปค๋ด ์ปค์คํ ๋ทฐ๋ฅผ ์ง์ํฉ๋๋ค. `0.0.57`
> ```js
>
>
>
> width: 32, height: 32,
> backgroundColor: 'rgba(0,0,0,0.2)', resizeMode: 'stretch',
> borderWidth: 2, borderColor: 'black'}} fadeDuration={0}/>
> Image
>
>
> image background
>
>
>
> ```### `Polyline`
```ts
interface PolylineProps {
coordinates: Coord[]
strokeWidth?: number
strokeColor?: string
onClick?: () => void
}
```### `Path`
```ts
interface PathProps {
coordinates: Coord[]
width?: number
color?: string
outlineWidth?: number
passedColor?: string
outlineColor?: string
passedOutlineColor?: string
pattern?: ImageSourcePropType
patternInterval?: number
onClick?: () => void
}
```### `Circle`
```ts
export interface CircleProps {
coordinate: Coord[]
radius?: number;
color?: string;
outlineWidth?: number;
outlineColor?: string;
zIndex?: number;
onClick?: () => void
}
```### `Polygon`
```ts
export interface PolygonProps {
coordinate: Coord[]
outlineWidth?: number;
outlineColor?: string
color?: string;
holes?: Coord[][];
onClick?: () => void
}
```### `LayerGroup`
```ts
export declare enum LayerGroup {
LAYER_GROUP_BUILDING = "building",
LAYER_GROUP_TRANSIT = "transit",
LAYER_GROUP_BICYCLE = "bike",
LAYER_GROUP_TRAFFIC = "ctt",
LAYER_GROUP_CADASTRAL = "landparcel",
LAYER_GROUP_MOUNTAIN = "mountain"
}
```## ์ฐธ๊ณ
- *react-navigation*์ ์คํ ์คํฌ๋ฆฐ ์ฌ์ฉ์ ์๋๋ก์ด๋์์ ๋งต๋ทฐ๊ฐ ๊ฒน์ณ ๋ณด์ด๋ ํ์์ด ์์ ๊ฒฝ์ฐ `useTextureView` ์ต์ ์ ์ถ๊ฐํด ์ฃผ์ธ์. [#27](https://github.com/QuadFlask/react-native-naver-map/issues/27)
- ์๋๋ก์ด๋์์ `ScrollView` ๋ด๋ถ์ ์ถ๊ฐํ ๊ฒฝ์ฐ `scrollGesturesEnabled`๋ฅผ ์ด์ฉํด ๋งต ์คํฌ๋กค์ ์ ์ดํ ์ ์์ต๋๋ค. [#62](https://github.com/QuadFlask/react-native-naver-map/issues/62)
- ๋ง์ปค ํด๋ฌ์คํฐ๋ง์ ํ์ํ ์ง๋ ์ปจํ ์ธ ์์ญ์ `onCameraChange` ์ด๋ฒคํธ๋ฅผ ํตํด ์ป์ ์ ์์ต๋๋ค. [#64](https://github.com/QuadFlask/react-native-naver-map/issues/64)