Skip to content

Commit

Permalink
타입 정의 추가, 버전 업데이트
Browse files Browse the repository at this point in the history
  • Loading branch information
QuadFlask committed Oct 22, 2019
1 parent a71c67f commit 7920d63
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 10 deletions.
32 changes: 26 additions & 6 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,26 @@ export declare const LayerGroup: {
LAYER_GROUP_CADASTRAL: string;
LAYER_GROUP_MOUNTAIN: string;
};
export declare enum Gravity {
NO_GRAVITY = 0,
AXIS_SPECIFIED = 1,
AXIS_PULL_BEFORE = 2,
AXIS_PULL_AFTER = 4,
AXIS_X_SHIFT = 0,
AXIS_Y_SHIFT = 4,
TOP = 48,
BOTTOM = 80,
LEFT = 3,
RIGHT = 5,
CENTER_VERTICAL = 16,
CENTER_HORIZONTAL = 1
}
export interface Rect {
left?: number;
top?: number;
right?: number;
bottom?: number;
}
export interface NaverMapViewProps {
style?: StyleProp<ViewStyle>;
center?: Coord & {
Expand All @@ -35,12 +55,9 @@ export interface NaverMapViewProps {
};
tilt?: number;
bearing?: number;
mapPadding?: {
left: number;
top: number;
right: number;
bottom: number;
};
mapPadding?: Rect;
logoMargin?: Rect;
logoGravity?: Gravity;
onInitialized?: Function;
onCameraChange?: (event: {
latitude: number;
Expand Down Expand Up @@ -127,6 +144,9 @@ interface CircleProps {
coordinate: Coord;
radius?: number;
color?: string;
outlineWidth?: number;
outlineColor?: string;
zIndex?: number;
}
export declare class Circle extends Component<CircleProps> {
render(): JSX.Element;
Expand Down
19 changes: 17 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ export const LayerGroup = {
LAYER_GROUP_CADASTRAL: 'landparcel',
LAYER_GROUP_MOUNTAIN: 'mountain',
};
export var Gravity;
(function (Gravity) {
Gravity[Gravity["NO_GRAVITY"] = 0] = "NO_GRAVITY";
Gravity[Gravity["AXIS_SPECIFIED"] = 1] = "AXIS_SPECIFIED";
Gravity[Gravity["AXIS_PULL_BEFORE"] = 2] = "AXIS_PULL_BEFORE";
Gravity[Gravity["AXIS_PULL_AFTER"] = 4] = "AXIS_PULL_AFTER";
Gravity[Gravity["AXIS_X_SHIFT"] = 0] = "AXIS_X_SHIFT";
Gravity[Gravity["AXIS_Y_SHIFT"] = 4] = "AXIS_Y_SHIFT";
Gravity[Gravity["TOP"] = 48] = "TOP";
Gravity[Gravity["BOTTOM"] = 80] = "BOTTOM";
Gravity[Gravity["LEFT"] = 3] = "LEFT";
Gravity[Gravity["RIGHT"] = 5] = "RIGHT";
Gravity[Gravity["CENTER_VERTICAL"] = 16] = "CENTER_VERTICAL";
Gravity[Gravity["CENTER_HORIZONTAL"] = 1] = "CENTER_HORIZONTAL";
})(Gravity || (Gravity = {}));
export default class NaverMapView extends Component {
constructor() {
super(...arguments);
Expand Down Expand Up @@ -61,8 +76,8 @@ export default class NaverMapView extends Component {
this.handleOnMapClick = (event) => this.props.onMapClick && this.props.onMapClick(event.nativeEvent);
}
render() {
const { onInitialized, center, tilt, bearing, mapPadding, nightMode, } = this.props;
return React.createElement(RNNaverMapView, Object.assign({ ref: this.resolveRef }, this.props, { onInitialized: onInitialized, center: center, mapPadding: mapPadding, tilt: tilt, bearing: bearing, nightMode: nightMode, onCameraChange: this.handleOnCameraChange, onMapClick: this.handleOnMapClick }));
const { onInitialized, center, tilt, bearing, mapPadding, logoMargin, nightMode, } = this.props;
return React.createElement(RNNaverMapView, Object.assign({ ref: this.resolveRef }, this.props, { onInitialized: onInitialized, center: center, mapPadding: mapPadding, logoMargin: logoMargin, tilt: tilt, bearing: bearing, nightMode: nightMode, onCameraChange: this.handleOnCameraChange, onMapClick: this.handleOnMapClick }));
}
}
export class Marker extends Component {
Expand Down
31 changes: 30 additions & 1 deletion index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,36 @@ export const LayerGroup = {
LAYER_GROUP_MOUNTAIN: 'mountain',
};

export enum Gravity {
NO_GRAVITY = 0x0000,
AXIS_SPECIFIED = 0x0001,
AXIS_PULL_BEFORE = 0x0002,
AXIS_PULL_AFTER = 0x0004,
AXIS_X_SHIFT = 0,
AXIS_Y_SHIFT = 4,
TOP = (AXIS_PULL_BEFORE | AXIS_SPECIFIED) << AXIS_Y_SHIFT,
BOTTOM = (AXIS_PULL_AFTER | AXIS_SPECIFIED) << AXIS_Y_SHIFT,
LEFT = (AXIS_PULL_BEFORE | AXIS_SPECIFIED) << AXIS_X_SHIFT,
RIGHT = (AXIS_PULL_AFTER | AXIS_SPECIFIED) << AXIS_X_SHIFT,
CENTER_VERTICAL = AXIS_SPECIFIED << AXIS_Y_SHIFT,
CENTER_HORIZONTAL = AXIS_SPECIFIED << AXIS_X_SHIFT,
}

export interface Rect {
left?: number
top?: number
right?: number
bottom?: number
}

export interface NaverMapViewProps {
style?: StyleProp<ViewStyle>;
center?: Coord & { zoom?: number; tilt?: number; bearing?: number };
tilt?: number;
bearing?: number;
mapPadding?: { left: number; top: number; right: number; bottom: number };
mapPadding?: Rect;
logoMargin?: Rect;
logoGravity?: Gravity;
onInitialized?: Function;
onCameraChange?: (event: {
latitude: number;
Expand Down Expand Up @@ -127,6 +151,7 @@ export default class NaverMapView extends Component<NaverMapViewProps> {
tilt,
bearing,
mapPadding,
logoMargin,
nightMode,
} = this.props;

Expand All @@ -136,6 +161,7 @@ export default class NaverMapView extends Component<NaverMapViewProps> {
onInitialized={onInitialized}
center={center}
mapPadding={mapPadding}
logoMargin={logoMargin}
tilt={tilt}
bearing={bearing}
nightMode={nightMode}
Expand Down Expand Up @@ -185,6 +211,9 @@ interface CircleProps {
coordinate: Coord;
radius?: number;
color?: string;
outlineWidth?: number
outlineColor?: string
zIndex?: number
}

export class Circle extends Component<CircleProps> {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-nmap",
"version": "0.0.36",
"version": "0.0.37",
"description": "react-native bridge for naver map",
"main": "index.js",
"author": "QuadFlask",
Expand Down

0 comments on commit 7920d63

Please sign in to comment.