@react-native-kakao/map 2.2.7 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +5 -38
- package/RNCKakaoMap.podspec +16 -52
- package/android/build.gradle +12 -107
- package/android/consumer-rules.pro +2 -0
- package/android/src/main/AndroidManifest.xml +3 -1
- package/android/src/main/java/net/mjstudio/rnkakao/map/CameraOptions.kt +61 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/KakaoMapModule.kt +131 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/KakaoMapView.kt +1257 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/MapCameraCommands.kt +306 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/MapDimScreen.kt +431 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/MapGui.kt +899 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/MapImageLoader.kt +232 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/MapLabels.kt +1572 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/MapOptions.kt +360 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/MapRoutes.kt +805 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/MapShapes.kt +1096 -0
- package/android/src/main/java/net/mjstudio/rnkakao/map/MapUtilities.kt +495 -0
- package/expo-module.config.json +5 -0
- package/ios/CameraOptions.swift +41 -0
- package/ios/KakaoMapModule.swift +204 -0
- package/ios/KakaoMapView.swift +1018 -0
- package/ios/MapCameraCommands.swift +451 -0
- package/ios/MapDimScreen.swift +463 -0
- package/ios/MapGui.swift +1099 -0
- package/ios/MapImageLoader.swift +177 -0
- package/ios/MapLabels.swift +1676 -0
- package/ios/MapOptions.swift +374 -0
- package/ios/MapRoutes.swift +903 -0
- package/ios/MapShapes.swift +1294 -0
- package/ios/MapUnits.swift +20 -0
- package/ios/MapUtilities.swift +365 -0
- package/lib/commonjs/index.js +180 -29
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +18 -0
- package/lib/commonjs/index.web.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/types-assets.js +2 -0
- package/lib/commonjs/types-assets.js.map +1 -0
- package/lib/commonjs/types-camera.js +6 -0
- package/lib/commonjs/types-camera.js.map +1 -0
- package/lib/commonjs/types-dim.js +6 -0
- package/lib/commonjs/types-dim.js.map +1 -0
- package/lib/commonjs/types-gui.js +6 -0
- package/lib/commonjs/types-gui.js.map +1 -0
- package/lib/commonjs/types-labels.js +6 -0
- package/lib/commonjs/types-labels.js.map +1 -0
- package/lib/commonjs/types-routes.js +6 -0
- package/lib/commonjs/types-routes.js.map +1 -0
- package/lib/commonjs/types-shapes.js +6 -0
- package/lib/commonjs/types-shapes.js.map +1 -0
- package/lib/commonjs/types-utilities.js +6 -0
- package/lib/commonjs/types-utilities.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/index.js +180 -22
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +13 -0
- package/lib/module/index.web.js.map +1 -0
- package/lib/module/types-assets.js +2 -0
- package/lib/module/types-assets.js.map +1 -0
- package/lib/module/types-camera.js +4 -0
- package/lib/module/types-camera.js.map +1 -0
- package/lib/module/types-dim.js +4 -0
- package/lib/module/types-dim.js.map +1 -0
- package/lib/module/types-gui.js +4 -0
- package/lib/module/types-gui.js.map +1 -0
- package/lib/module/types-labels.js +4 -0
- package/lib/module/types-labels.js.map +1 -0
- package/lib/module/types-routes.js +4 -0
- package/lib/module/types-routes.js.map +1 -0
- package/lib/module/types-shapes.js +4 -0
- package/lib/module/types-shapes.js.map +1 -0
- package/lib/module/types-utilities.js +4 -0
- package/lib/module/types-utilities.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/src/index.d.ts +59 -9
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types-assets.d.ts +9 -0
- package/lib/typescript/src/types-assets.d.ts.map +1 -0
- package/lib/typescript/src/types-camera.d.ts +123 -0
- package/lib/typescript/src/types-camera.d.ts.map +1 -0
- package/lib/typescript/src/types-dim.d.ts +54 -0
- package/lib/typescript/src/types-dim.d.ts.map +1 -0
- package/lib/typescript/src/types-gui.d.ts +189 -0
- package/lib/typescript/src/types-gui.d.ts.map +1 -0
- package/lib/typescript/src/types-labels.d.ts +246 -0
- package/lib/typescript/src/types-labels.d.ts.map +1 -0
- package/lib/typescript/src/types-routes.d.ts +162 -0
- package/lib/typescript/src/types-routes.d.ts.map +1 -0
- package/lib/typescript/src/types-shapes.d.ts +253 -0
- package/lib/typescript/src/types-shapes.d.ts.map +1 -0
- package/lib/typescript/src/types-utilities.d.ts +130 -0
- package/lib/typescript/src/types-utilities.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +222 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +24 -77
- package/src/index.tsx +322 -0
- package/src/index.web.tsx +46 -0
- package/src/types-assets.ts +8 -0
- package/src/types-camera.ts +97 -0
- package/src/types-dim.ts +54 -0
- package/src/types-gui.ts +171 -0
- package/src/types-labels.ts +207 -0
- package/src/types-routes.ts +118 -0
- package/src/types-shapes.ts +244 -0
- package/src/types-utilities.ts +115 -0
- package/src/types.ts +223 -0
- package/android/gradle.properties +0 -1
- package/android/src/main/AndroidManifestNew.xml +0 -2
- package/android/src/main/java/net/mjstudio/rnkakao/map/RNCKakaoMapModule.kt +0 -25
- package/android/src/main/java/net/mjstudio/rnkakao/map/RNCKakaoMapPackage.kt +0 -35
- package/android/src/newarch/KakaoMapSpec.kt +0 -7
- package/android/src/oldarch/KakaoMapSpec.kt +0 -14
- package/ios/Component/Map/RNCKakaoMapView.h +0 -23
- package/ios/Component/Map/RNCKakaoMapView.mm +0 -209
- package/ios/Component/Map/RNCKakaoMapViewManager.mm +0 -19
- package/ios/NativeModule/RNCKakaoMap.h +0 -7
- package/ios/NativeModule/RNCKakaoMap.mm +0 -19
- package/ios/NativeModule/RNCKakaoMapManager.swift +0 -7
- package/ios/Util/Util.h +0 -97
- package/lib/commonjs/component/KakaoMapView.js +0 -54
- package/lib/commonjs/component/KakaoMapView.js.map +0 -1
- package/lib/commonjs/spec/NativeKakaoMap.js +0 -9
- package/lib/commonjs/spec/NativeKakaoMap.js.map +0 -1
- package/lib/commonjs/spec/RNCKakaoMapViewNativeComponent.js +0 -15
- package/lib/commonjs/spec/RNCKakaoMapViewNativeComponent.js.map +0 -1
- package/lib/commonjs/type/type.js +0 -2
- package/lib/commonjs/type/type.js.map +0 -1
- package/lib/commonjs/util/Const.js +0 -14
- package/lib/commonjs/util/Const.js.map +0 -1
- package/lib/commonjs/util/Util.js +0 -15
- package/lib/commonjs/util/Util.js.map +0 -1
- package/lib/module/component/KakaoMapView.js +0 -48
- package/lib/module/component/KakaoMapView.js.map +0 -1
- package/lib/module/spec/NativeKakaoMap.js +0 -3
- package/lib/module/spec/NativeKakaoMap.js.map +0 -1
- package/lib/module/spec/RNCKakaoMapViewNativeComponent.js +0 -10
- package/lib/module/spec/RNCKakaoMapViewNativeComponent.js.map +0 -1
- package/lib/module/type/type.js +0 -2
- package/lib/module/type/type.js.map +0 -1
- package/lib/module/util/Const.js +0 -8
- package/lib/module/util/Const.js.map +0 -1
- package/lib/module/util/Util.js +0 -9
- package/lib/module/util/Util.js.map +0 -1
- package/lib/typescript/src/component/KakaoMapView.d.ts +0 -25
- package/lib/typescript/src/component/KakaoMapView.d.ts.map +0 -1
- package/lib/typescript/src/spec/NativeKakaoMap.d.ts +0 -7
- package/lib/typescript/src/spec/NativeKakaoMap.d.ts.map +0 -1
- package/lib/typescript/src/spec/RNCKakaoMapViewNativeComponent.d.ts +0 -32
- package/lib/typescript/src/spec/RNCKakaoMapViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/src/type/type.d.ts +0 -8
- package/lib/typescript/src/type/type.d.ts.map +0 -1
- package/lib/typescript/src/util/Const.d.ts +0 -8
- package/lib/typescript/src/util/Const.d.ts.map +0 -1
- package/lib/typescript/src/util/Util.d.ts +0 -3
- package/lib/typescript/src/util/Util.d.ts.map +0 -1
- package/src/component/KakaoMapView.tsx +0 -82
- package/src/index.ts +0 -43
- package/src/spec/NativeKakaoMap.ts +0 -8
- package/src/spec/RNCKakaoMapViewNativeComponent.ts +0 -38
- package/src/type/type.ts +0 -7
- package/src/util/Const.ts +0 -7
- package/src/util/Util.ts +0 -11
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-kakao/map",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"version": "3.2.0",
|
|
4
|
+
"description": "Kakao Maps for Android and iOS using Expo Modules",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
7
7
|
"types": "lib/typescript/src/index.d.ts",
|
|
@@ -12,81 +12,40 @@
|
|
|
12
12
|
"lib",
|
|
13
13
|
"android",
|
|
14
14
|
"ios",
|
|
15
|
-
"cpp",
|
|
16
15
|
"*.podspec",
|
|
17
|
-
"
|
|
16
|
+
"expo-module.config.json",
|
|
18
17
|
"!android/build",
|
|
19
|
-
"!
|
|
20
|
-
"!android/gradlew",
|
|
21
|
-
"!android/gradlew.bat",
|
|
22
|
-
"!android/local.properties",
|
|
23
|
-
"!**/__tests__",
|
|
24
|
-
"!**/__fixtures__",
|
|
25
|
-
"!**/__mocks__",
|
|
26
|
-
"!**/.*"
|
|
18
|
+
"!ios/build"
|
|
27
19
|
],
|
|
28
20
|
"author": "MJ Studio <mym0404@gmail.com> (https://github.com/mym0404)",
|
|
29
|
-
"homepage": "https://rnkakao.
|
|
30
|
-
"
|
|
31
|
-
"test": "jest",
|
|
32
|
-
"prepare": "husky",
|
|
33
|
-
"release": "./script/release.sh",
|
|
34
|
-
"codegen:android": "cd ../../example/android && ./gradlew generateCodegenArtifactsFromSchema",
|
|
35
|
-
"codegen:ios": "node ../../example/node_modules/react-native/scripts/generate-codegen-artifacts.js --path example/ --outputPath ../../example/ios",
|
|
36
|
-
"codegen": "yarn codegen:android && yarn codegen:ios",
|
|
37
|
-
"prepack": "bob build",
|
|
38
|
-
"clean": "del-cli android/ lib"
|
|
39
|
-
},
|
|
40
|
-
"keywords": [
|
|
41
|
-
"react-native",
|
|
42
|
-
"kakao",
|
|
43
|
-
"kakao-sdk",
|
|
44
|
-
"typescript",
|
|
45
|
-
"javascript",
|
|
46
|
-
"react",
|
|
47
|
-
"expo",
|
|
48
|
-
"kakao-navi",
|
|
49
|
-
"kakao-navigation",
|
|
50
|
-
"kakao-api",
|
|
51
|
-
"login",
|
|
52
|
-
"auth"
|
|
53
|
-
],
|
|
21
|
+
"homepage": "https://rnkakao.mjstudio.net",
|
|
22
|
+
"license": "MIT",
|
|
54
23
|
"repository": {
|
|
55
24
|
"type": "git",
|
|
56
25
|
"url": "https://github.com/mym0404/react-native-kakao.git",
|
|
57
|
-
"directory": "packages/
|
|
26
|
+
"directory": "packages/map"
|
|
58
27
|
},
|
|
59
|
-
"license": "MIT",
|
|
60
28
|
"publishConfig": {
|
|
61
|
-
"
|
|
62
|
-
"
|
|
29
|
+
"access": "public",
|
|
30
|
+
"registry": "https://registry.npmjs.org/"
|
|
63
31
|
},
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"@types/jest": "^29.5.5",
|
|
68
|
-
"@types/react": "^18.2.44",
|
|
69
|
-
"del-cli": "^5.1.0",
|
|
70
|
-
"jest": "^29.7.0",
|
|
71
|
-
"react": "18.2.0",
|
|
72
|
-
"react-native": "0.74.0",
|
|
73
|
-
"react-native-builder-bob": "^0.20.0",
|
|
74
|
-
"typescript": "5.1.6"
|
|
32
|
+
"scripts": {
|
|
33
|
+
"prepack": "bob build && node ../../script/remove-web-declaration-files.ts .",
|
|
34
|
+
"clean": "del-cli lib android/build ios/build"
|
|
75
35
|
},
|
|
76
36
|
"peerDependencies": {
|
|
77
|
-
"
|
|
37
|
+
"expo": ">=52.0.0",
|
|
78
38
|
"react": "*",
|
|
79
|
-
"react-native": "
|
|
39
|
+
"react-native": ">=0.76.0"
|
|
80
40
|
},
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
]
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/react": "~19.2.2",
|
|
43
|
+
"del-cli": "^5.1.0",
|
|
44
|
+
"expo": "^58.0.19",
|
|
45
|
+
"react": "19.3.0",
|
|
46
|
+
"react-native": "0.88.0",
|
|
47
|
+
"react-native-builder-bob": "0.40.7",
|
|
48
|
+
"typescript": "~6.0.3"
|
|
90
49
|
},
|
|
91
50
|
"react-native-builder-bob": {
|
|
92
51
|
"source": "src",
|
|
@@ -101,17 +60,5 @@
|
|
|
101
60
|
}
|
|
102
61
|
]
|
|
103
62
|
]
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
"name": "RNCKakaoMapSpec",
|
|
107
|
-
"type": "all",
|
|
108
|
-
"jsSrcsDir": "src",
|
|
109
|
-
"android": {
|
|
110
|
-
"javaPackageName": "net.mjstudio.rnkakao.map"
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
"dependencies": {
|
|
114
|
-
"@mj-studio/js-util": "1.1.3"
|
|
115
|
-
},
|
|
116
|
-
"gitHead": "5a64db286916be9c5f33ce13695790afcb963483"
|
|
117
|
-
}
|
|
63
|
+
}
|
|
64
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { forwardRef, type Ref, useImperativeHandle, useRef } from 'react';
|
|
2
|
+
import type { NativeSyntheticEvent } from 'react-native';
|
|
3
|
+
import { requireNativeModule, requireNativeView } from 'expo';
|
|
4
|
+
|
|
5
|
+
import type {
|
|
6
|
+
CameraMoveEvent,
|
|
7
|
+
CameraPosition,
|
|
8
|
+
CameraUpdate,
|
|
9
|
+
Coordinate,
|
|
10
|
+
KakaoMapError,
|
|
11
|
+
KakaoMapViewProps,
|
|
12
|
+
KakaoMapViewRef,
|
|
13
|
+
MapClickEvent,
|
|
14
|
+
MapInfo,
|
|
15
|
+
MapPadding,
|
|
16
|
+
MapViewport,
|
|
17
|
+
PoiClickEvent,
|
|
18
|
+
ScreenPoint,
|
|
19
|
+
} from './types';
|
|
20
|
+
import type { AdvancedCameraOperationEvent } from './types-camera';
|
|
21
|
+
import type { DimScreenEvent } from './types-dim';
|
|
22
|
+
import type { MapGuiEvent } from './types-gui';
|
|
23
|
+
import type { LabelAnimationEvent, LabelClickEvent, LabelRuntimeState } from './types-labels';
|
|
24
|
+
import type { RouteAnimationStopEvent, RouteCounts, RouteProgressEvent } from './types-routes';
|
|
25
|
+
import type { ShapeAnimationStopEvent, ShapeCounts } from './types-shapes';
|
|
26
|
+
|
|
27
|
+
export type { MapImageSource } from './types-assets';
|
|
28
|
+
export type * from './types-labels';
|
|
29
|
+
export type * from './types-shapes';
|
|
30
|
+
export type * from './types-routes';
|
|
31
|
+
export type * from './types-gui';
|
|
32
|
+
export type * from './types-dim';
|
|
33
|
+
export type * from './types-utilities';
|
|
34
|
+
export type * from './types-camera';
|
|
35
|
+
|
|
36
|
+
export type {
|
|
37
|
+
CameraOptions,
|
|
38
|
+
CameraUpdate,
|
|
39
|
+
CameraPosition,
|
|
40
|
+
CameraMoveEvent,
|
|
41
|
+
Coordinate,
|
|
42
|
+
KakaoMapError,
|
|
43
|
+
KakaoMapViewProps,
|
|
44
|
+
KakaoMapViewRef,
|
|
45
|
+
MapClickEvent,
|
|
46
|
+
MapGesture,
|
|
47
|
+
MapInfo,
|
|
48
|
+
MapOptions,
|
|
49
|
+
MapOverlay,
|
|
50
|
+
MapPadding,
|
|
51
|
+
MapType,
|
|
52
|
+
MapWidgetPosition,
|
|
53
|
+
MapViewport,
|
|
54
|
+
PoiClickEvent,
|
|
55
|
+
ScreenPoint,
|
|
56
|
+
} from './types';
|
|
57
|
+
|
|
58
|
+
const moduleName = 'RNCKakaoMap';
|
|
59
|
+
const NativeView = requireNativeView<
|
|
60
|
+
Omit<
|
|
61
|
+
KakaoMapViewProps,
|
|
62
|
+
| 'onError'
|
|
63
|
+
| 'onCameraMoveStart'
|
|
64
|
+
| 'onCameraIdle'
|
|
65
|
+
| 'onMapClick'
|
|
66
|
+
| 'onMapLongClick'
|
|
67
|
+
| 'onTerrainClick'
|
|
68
|
+
| 'onViewportClick'
|
|
69
|
+
| 'onVisibilityChanged'
|
|
70
|
+
| 'onFocusChanged'
|
|
71
|
+
| 'onPoiClick'
|
|
72
|
+
| 'onMapTypeChanged'
|
|
73
|
+
| 'onPaddingChanged'
|
|
74
|
+
| 'onViewportChanged'
|
|
75
|
+
| 'onLabelClick'
|
|
76
|
+
| 'onLabelAnimationStopped'
|
|
77
|
+
| 'onLabelsChanged'
|
|
78
|
+
| 'onShapeAnimationStop'
|
|
79
|
+
| 'onShapesChanged'
|
|
80
|
+
| 'onRoutesChanged'
|
|
81
|
+
| 'onRouteProgress'
|
|
82
|
+
| 'onRouteAnimationStop'
|
|
83
|
+
| 'onGuiEvent'
|
|
84
|
+
| 'onDimScreenEvent'
|
|
85
|
+
| 'onCameraOperation'
|
|
86
|
+
> & {
|
|
87
|
+
ref: Ref<NativeMapRef>;
|
|
88
|
+
onError?: (event: NativeSyntheticEvent<KakaoMapError>) => void;
|
|
89
|
+
onCameraMoveStart?: (event: NativeSyntheticEvent<CameraMoveEvent>) => void;
|
|
90
|
+
onCameraIdle?: (
|
|
91
|
+
event: NativeSyntheticEvent<CameraMoveEvent & { camera: CameraPosition }>,
|
|
92
|
+
) => void;
|
|
93
|
+
onMapClick?: (event: NativeSyntheticEvent<MapClickEvent>) => void;
|
|
94
|
+
onMapLongClick?: (event: NativeSyntheticEvent<Coordinate>) => void;
|
|
95
|
+
onTerrainClick?: (event: NativeSyntheticEvent<Coordinate>) => void;
|
|
96
|
+
onViewportClick?: (event: NativeSyntheticEvent<MapClickEvent>) => void;
|
|
97
|
+
onVisibilityChanged?: (event: NativeSyntheticEvent<{ visible: boolean }>) => void;
|
|
98
|
+
onFocusChanged?: (event: NativeSyntheticEvent<{ focused: boolean }>) => void;
|
|
99
|
+
onPoiClick?: (event: NativeSyntheticEvent<PoiClickEvent>) => void;
|
|
100
|
+
onMapTypeChanged?: (event: NativeSyntheticEvent<{ viewInfoName: string }>) => void;
|
|
101
|
+
onPaddingChanged?: (event: NativeSyntheticEvent<MapPadding>) => void;
|
|
102
|
+
onViewportChanged?: (event: NativeSyntheticEvent<MapViewport>) => void;
|
|
103
|
+
onLabelClick?: (event: NativeSyntheticEvent<LabelClickEvent>) => void;
|
|
104
|
+
onLabelAnimationStopped?: (event: NativeSyntheticEvent<LabelAnimationEvent>) => void;
|
|
105
|
+
onLabelsChanged?: (event: NativeSyntheticEvent<LabelRuntimeState>) => void;
|
|
106
|
+
onShapeAnimationStop?: (event: NativeSyntheticEvent<ShapeAnimationStopEvent>) => void;
|
|
107
|
+
onShapesChanged?: (event: NativeSyntheticEvent<ShapeCounts>) => void;
|
|
108
|
+
onRoutesChanged?: (event: NativeSyntheticEvent<RouteCounts>) => void;
|
|
109
|
+
onRouteProgress?: (event: NativeSyntheticEvent<RouteProgressEvent>) => void;
|
|
110
|
+
onRouteAnimationStop?: (event: NativeSyntheticEvent<RouteAnimationStopEvent>) => void;
|
|
111
|
+
onGuiEvent?: (event: NativeSyntheticEvent<MapGuiEvent>) => void;
|
|
112
|
+
onDimScreenEvent?: (event: NativeSyntheticEvent<DimScreenEvent>) => void;
|
|
113
|
+
onCameraOperation?: (event: NativeSyntheticEvent<AdvancedCameraOperationEvent>) => void;
|
|
114
|
+
}
|
|
115
|
+
>(moduleName);
|
|
116
|
+
|
|
117
|
+
type NativeMapRef = Omit<
|
|
118
|
+
KakaoMapViewRef,
|
|
119
|
+
'moveCamera' | 'updateCamera' | 'showInfoWindow' | 'moveInfoWindow'
|
|
120
|
+
> & {
|
|
121
|
+
moveCamera: (camera: NonNullable<KakaoMapViewProps['camera']>, duration: number) => Promise<void>;
|
|
122
|
+
getCamera: () => Promise<CameraPosition>;
|
|
123
|
+
updateCamera: (update: CameraUpdate, duration: number) => Promise<void>;
|
|
124
|
+
getMapInfo: () => Promise<MapInfo>;
|
|
125
|
+
screenToCoordinate: (point: ScreenPoint) => Promise<Coordinate>;
|
|
126
|
+
coordinateToScreen: (coordinate: Coordinate) => Promise<ScreenPoint>;
|
|
127
|
+
clearCache: () => Promise<void>;
|
|
128
|
+
showInfoWindow: (id: string, autoMove: boolean, duration: number | null) => Promise<void>;
|
|
129
|
+
moveInfoWindow: (id: string, position: Coordinate, duration: number) => Promise<void>;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export function initializeKakaoMapSDK(nativeAppKey: string): Promise<void> {
|
|
133
|
+
return requireNativeModule<{ initialize: (key: string) => Promise<void> }>(moduleName).initialize(
|
|
134
|
+
nativeAppKey,
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export const KakaoMapView = forwardRef<KakaoMapViewRef, KakaoMapViewProps>(function KakaoMapView(
|
|
139
|
+
{
|
|
140
|
+
onMapReady,
|
|
141
|
+
onError,
|
|
142
|
+
onCameraMoveStart,
|
|
143
|
+
onCameraIdle,
|
|
144
|
+
onMapClick,
|
|
145
|
+
onMapLongClick,
|
|
146
|
+
onTerrainClick,
|
|
147
|
+
onViewportClick,
|
|
148
|
+
onVisibilityChanged,
|
|
149
|
+
onFocusChanged,
|
|
150
|
+
onPoiClick,
|
|
151
|
+
onCompassClick,
|
|
152
|
+
onMapTypeChanged,
|
|
153
|
+
onPaddingChanged,
|
|
154
|
+
onViewportChanged,
|
|
155
|
+
onLabelClick,
|
|
156
|
+
onLabelAnimationStopped,
|
|
157
|
+
onLabelsChanged,
|
|
158
|
+
onShapeAnimationStop,
|
|
159
|
+
onShapesChanged,
|
|
160
|
+
onRoutesChanged,
|
|
161
|
+
onRouteProgress,
|
|
162
|
+
onRouteAnimationStop,
|
|
163
|
+
onGuiEvent,
|
|
164
|
+
onDimScreenEvent,
|
|
165
|
+
onCameraOperation,
|
|
166
|
+
...props
|
|
167
|
+
},
|
|
168
|
+
ref,
|
|
169
|
+
) {
|
|
170
|
+
const nativeRef = useRef<NativeMapRef>(null);
|
|
171
|
+
useImperativeHandle(
|
|
172
|
+
ref,
|
|
173
|
+
() => ({
|
|
174
|
+
async moveCamera(camera, options) {
|
|
175
|
+
await getView().moveCamera(camera, options?.duration ?? 0);
|
|
176
|
+
},
|
|
177
|
+
async getCamera() {
|
|
178
|
+
return getView().getCamera();
|
|
179
|
+
},
|
|
180
|
+
async updateCamera(update, options) {
|
|
181
|
+
await getView().updateCamera(update, options?.duration ?? 0);
|
|
182
|
+
},
|
|
183
|
+
async getMapInfo() {
|
|
184
|
+
return getView().getMapInfo();
|
|
185
|
+
},
|
|
186
|
+
async screenToCoordinate(point) {
|
|
187
|
+
return getView().screenToCoordinate(point);
|
|
188
|
+
},
|
|
189
|
+
async coordinateToScreen(coordinate) {
|
|
190
|
+
return getView().coordinateToScreen(coordinate);
|
|
191
|
+
},
|
|
192
|
+
async clearCache() {
|
|
193
|
+
await getView().clearCache();
|
|
194
|
+
},
|
|
195
|
+
async runLabelCommand(command) {
|
|
196
|
+
await getView().runLabelCommand(command);
|
|
197
|
+
},
|
|
198
|
+
async getLabelCapabilities() {
|
|
199
|
+
return getView().getLabelCapabilities();
|
|
200
|
+
},
|
|
201
|
+
async getLabelState() {
|
|
202
|
+
return getView().getLabelState();
|
|
203
|
+
},
|
|
204
|
+
async applyShapes(scene) {
|
|
205
|
+
return getView().applyShapes(scene);
|
|
206
|
+
},
|
|
207
|
+
async executeShapeCommand(command) {
|
|
208
|
+
return getView().executeShapeCommand(command);
|
|
209
|
+
},
|
|
210
|
+
async applyRoutes(scene) {
|
|
211
|
+
return getView().applyRoutes(scene);
|
|
212
|
+
},
|
|
213
|
+
async executeRouteCommand(command) {
|
|
214
|
+
return getView().executeRouteCommand(command);
|
|
215
|
+
},
|
|
216
|
+
async applyGui(scene) {
|
|
217
|
+
await getView().applyGui(scene);
|
|
218
|
+
},
|
|
219
|
+
async showInfoWindow(id, options) {
|
|
220
|
+
await getView().showInfoWindow(id, options?.autoMove ?? false, options?.duration ?? null);
|
|
221
|
+
},
|
|
222
|
+
async hideInfoWindow(id) {
|
|
223
|
+
await getView().hideInfoWindow(id);
|
|
224
|
+
},
|
|
225
|
+
async moveInfoWindow(id, position, options) {
|
|
226
|
+
await getView().moveInfoWindow(id, position, options?.duration ?? 0);
|
|
227
|
+
},
|
|
228
|
+
async showWidget(id) {
|
|
229
|
+
await getView().showWidget(id);
|
|
230
|
+
},
|
|
231
|
+
async hideWidget(id) {
|
|
232
|
+
await getView().hideWidget(id);
|
|
233
|
+
},
|
|
234
|
+
async positionWidget(id, position) {
|
|
235
|
+
await getView().positionWidget(id, position);
|
|
236
|
+
},
|
|
237
|
+
async rotateWidget(id, rotation) {
|
|
238
|
+
await getView().rotateWidget(id, rotation);
|
|
239
|
+
},
|
|
240
|
+
async startGuiAnimation(id) {
|
|
241
|
+
await getView().startGuiAnimation(id);
|
|
242
|
+
},
|
|
243
|
+
async stopGuiAnimation(id) {
|
|
244
|
+
await getView().stopGuiAnimation(id);
|
|
245
|
+
},
|
|
246
|
+
async controlAnimatedImage(ownerType, ownerId, componentId, action) {
|
|
247
|
+
await getView().controlAnimatedImage(ownerType, ownerId, componentId, action);
|
|
248
|
+
},
|
|
249
|
+
async getGuiStatus() {
|
|
250
|
+
return getView().getGuiStatus();
|
|
251
|
+
},
|
|
252
|
+
async applyDimScreen(options) {
|
|
253
|
+
await getView().applyDimScreen(options);
|
|
254
|
+
},
|
|
255
|
+
async setDimHighlightVisible(id, visible) {
|
|
256
|
+
await getView().setDimHighlightVisible(id, visible);
|
|
257
|
+
},
|
|
258
|
+
async startDimAnimation(id) {
|
|
259
|
+
await getView().startDimAnimation(id);
|
|
260
|
+
},
|
|
261
|
+
async stopDimAnimation(id) {
|
|
262
|
+
await getView().stopDimAnimation(id);
|
|
263
|
+
},
|
|
264
|
+
async getDimScreenStatus() {
|
|
265
|
+
return getView().getDimScreenStatus();
|
|
266
|
+
},
|
|
267
|
+
async executeUtilityCommand(command) {
|
|
268
|
+
return getView().executeUtilityCommand(command);
|
|
269
|
+
},
|
|
270
|
+
async requestPoiState() {
|
|
271
|
+
return getView().requestPoiState();
|
|
272
|
+
},
|
|
273
|
+
async executeCameraCommand(command) {
|
|
274
|
+
return getView().executeCameraCommand(command);
|
|
275
|
+
},
|
|
276
|
+
}),
|
|
277
|
+
[],
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
return (
|
|
281
|
+
<NativeView
|
|
282
|
+
{...props}
|
|
283
|
+
ref={nativeRef}
|
|
284
|
+
onMapReady={() => onMapReady?.()}
|
|
285
|
+
onError={(event) => onError?.(event.nativeEvent)}
|
|
286
|
+
onCameraMoveStart={(event) => onCameraMoveStart?.(event.nativeEvent)}
|
|
287
|
+
onCameraIdle={(event) => onCameraIdle?.(event.nativeEvent)}
|
|
288
|
+
onMapClick={(event) => onMapClick?.(event.nativeEvent)}
|
|
289
|
+
onMapLongClick={(event) => onMapLongClick?.(event.nativeEvent)}
|
|
290
|
+
onTerrainClick={(event) => onTerrainClick?.(event.nativeEvent)}
|
|
291
|
+
onViewportClick={(event) => onViewportClick?.(event.nativeEvent)}
|
|
292
|
+
onVisibilityChanged={(event) => onVisibilityChanged?.(event.nativeEvent)}
|
|
293
|
+
onFocusChanged={(event) => onFocusChanged?.(event.nativeEvent)}
|
|
294
|
+
onPoiClick={(event) => onPoiClick?.(event.nativeEvent)}
|
|
295
|
+
onCompassClick={() => onCompassClick?.()}
|
|
296
|
+
onMapTypeChanged={(event) => onMapTypeChanged?.(event.nativeEvent)}
|
|
297
|
+
onPaddingChanged={(event) => onPaddingChanged?.(event.nativeEvent)}
|
|
298
|
+
onViewportChanged={(event) => onViewportChanged?.(event.nativeEvent)}
|
|
299
|
+
onLabelClick={(event) => onLabelClick?.(event.nativeEvent)}
|
|
300
|
+
onLabelAnimationStopped={(event) => onLabelAnimationStopped?.(event.nativeEvent)}
|
|
301
|
+
onLabelsChanged={(event) => onLabelsChanged?.(event.nativeEvent)}
|
|
302
|
+
onShapeAnimationStop={(event) => onShapeAnimationStop?.(event.nativeEvent)}
|
|
303
|
+
onShapesChanged={(event) => onShapesChanged?.(event.nativeEvent)}
|
|
304
|
+
onRoutesChanged={(event) => onRoutesChanged?.(event.nativeEvent)}
|
|
305
|
+
onRouteProgress={(event) => onRouteProgress?.(event.nativeEvent)}
|
|
306
|
+
onRouteAnimationStop={(event) => onRouteAnimationStop?.(event.nativeEvent)}
|
|
307
|
+
onGuiEvent={(event) => onGuiEvent?.(event.nativeEvent)}
|
|
308
|
+
onDimScreenEvent={(event) => onDimScreenEvent?.(event.nativeEvent)}
|
|
309
|
+
onCameraOperation={(event) => onCameraOperation?.(event.nativeEvent)}
|
|
310
|
+
/>
|
|
311
|
+
);
|
|
312
|
+
|
|
313
|
+
function getView() {
|
|
314
|
+
if (!nativeRef.current) {
|
|
315
|
+
throw Object.assign(new Error('The map view is not mounted.'), {
|
|
316
|
+
code: 'ERR_KAKAO_MAP_VIEW_DESTROYED',
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return nativeRef.current;
|
|
321
|
+
}
|
|
322
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { KakaoMapViewProps, KakaoMapViewRef } from './types';
|
|
4
|
+
|
|
5
|
+
export type { MapImageSource } from './types-assets';
|
|
6
|
+
export type * from './types-labels';
|
|
7
|
+
export type * from './types-shapes';
|
|
8
|
+
export type * from './types-routes';
|
|
9
|
+
export type * from './types-gui';
|
|
10
|
+
export type * from './types-dim';
|
|
11
|
+
export type * from './types-utilities';
|
|
12
|
+
export type * from './types-camera';
|
|
13
|
+
|
|
14
|
+
export type {
|
|
15
|
+
CameraOptions,
|
|
16
|
+
CameraUpdate,
|
|
17
|
+
CameraPosition,
|
|
18
|
+
CameraMoveEvent,
|
|
19
|
+
Coordinate,
|
|
20
|
+
KakaoMapError,
|
|
21
|
+
KakaoMapViewProps,
|
|
22
|
+
KakaoMapViewRef,
|
|
23
|
+
MapClickEvent,
|
|
24
|
+
MapGesture,
|
|
25
|
+
MapInfo,
|
|
26
|
+
MapOptions,
|
|
27
|
+
MapOverlay,
|
|
28
|
+
MapPadding,
|
|
29
|
+
MapType,
|
|
30
|
+
MapWidgetPosition,
|
|
31
|
+
MapViewport,
|
|
32
|
+
PoiClickEvent,
|
|
33
|
+
ScreenPoint,
|
|
34
|
+
} from './types';
|
|
35
|
+
|
|
36
|
+
const unsupported = () =>
|
|
37
|
+
Object.assign(new Error('KakaoMapView supports Android and iOS only.'), {
|
|
38
|
+
code: 'ERR_KAKAO_MAP_UNSUPPORTED_PLATFORM',
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export async function initializeKakaoMapSDK(_nativeAppKey: string): Promise<void> {
|
|
42
|
+
throw unsupported();
|
|
43
|
+
}
|
|
44
|
+
export const KakaoMapView = forwardRef<KakaoMapViewRef, KakaoMapViewProps>(function KakaoMapView() {
|
|
45
|
+
throw unsupported();
|
|
46
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** A URI returned by `Image.resolveAssetSource` or a file, HTTP, or HTTPS URI. */
|
|
2
|
+
export type MapImageSource = {
|
|
3
|
+
uri: string;
|
|
4
|
+
/** Requested native display width in density-independent points. */
|
|
5
|
+
width?: number;
|
|
6
|
+
/** Requested native display height in density-independent points. */
|
|
7
|
+
height?: number;
|
|
8
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { Coordinate, MapGesture, ScreenPoint } from './types';
|
|
2
|
+
|
|
3
|
+
export type AdvancedCameraAnimation = {
|
|
4
|
+
/** Milliseconds. Zero dispatches without an animation. */
|
|
5
|
+
duration: number;
|
|
6
|
+
autoElevation?: boolean;
|
|
7
|
+
consecutive?: boolean;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type HeightCameraPosition = Coordinate & {
|
|
11
|
+
/** Camera height in the native map coordinate system. */
|
|
12
|
+
height: number;
|
|
13
|
+
/** Degrees from the vertical. */
|
|
14
|
+
tilt: number;
|
|
15
|
+
/** Counterclockwise camera angle from north in degrees. */
|
|
16
|
+
rotation: number;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type CameraReferenceGesture = Extract<
|
|
20
|
+
MapGesture,
|
|
21
|
+
'rotate' | 'zoom' | 'tilt' | 'rotateZoom' | 'oneFingerZoom'
|
|
22
|
+
>;
|
|
23
|
+
|
|
24
|
+
type AnimatedAdvancedCameraCommand = {
|
|
25
|
+
animation?: AdvancedCameraAnimation;
|
|
26
|
+
/**
|
|
27
|
+
* Requests an actual-completion event. Unsupported platforms reject this field rather than
|
|
28
|
+
* reporting dispatch as completion.
|
|
29
|
+
*/
|
|
30
|
+
operationId?: string;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type AdvancedCameraCommand =
|
|
34
|
+
| { type: 'getCapabilities' }
|
|
35
|
+
| { type: 'getState' }
|
|
36
|
+
| ({ type: 'moveToHeight'; camera: HeightCameraPosition } & AnimatedAdvancedCameraCommand)
|
|
37
|
+
| ({
|
|
38
|
+
type: 'transform';
|
|
39
|
+
delta: Partial<Coordinate> & {
|
|
40
|
+
height?: number;
|
|
41
|
+
rotation?: number;
|
|
42
|
+
tilt?: number;
|
|
43
|
+
};
|
|
44
|
+
} & AnimatedAdvancedCameraCommand)
|
|
45
|
+
| ({
|
|
46
|
+
type: 'fit';
|
|
47
|
+
coordinates: Coordinate[];
|
|
48
|
+
/** Logical React Native pixels. */
|
|
49
|
+
padding?: number;
|
|
50
|
+
levelLimit?: number;
|
|
51
|
+
} & AnimatedAdvancedCameraCommand)
|
|
52
|
+
| {
|
|
53
|
+
type: 'canShow';
|
|
54
|
+
coordinates: Coordinate[];
|
|
55
|
+
zoomLevel: number;
|
|
56
|
+
rotation?: number;
|
|
57
|
+
weight?: number;
|
|
58
|
+
/** Logical React Native pixels. */
|
|
59
|
+
rect?: ScreenPoint & { width: number; height: number };
|
|
60
|
+
}
|
|
61
|
+
| { type: 'heightAtLevel'; zoomLevel: number }
|
|
62
|
+
| ({ type: 'resetOrientation' } & AnimatedAdvancedCameraCommand)
|
|
63
|
+
| { type: 'setBackToNorthDuringAutoElevation'; enabled: boolean }
|
|
64
|
+
| { type: 'setReferencePointLock'; gesture: CameraReferenceGesture; locked: boolean };
|
|
65
|
+
|
|
66
|
+
export type AdvancedCameraCapabilities = {
|
|
67
|
+
transform: boolean;
|
|
68
|
+
absoluteHeight: boolean;
|
|
69
|
+
heightAtLevel: boolean;
|
|
70
|
+
fit: { padding: boolean; levelLimit: boolean };
|
|
71
|
+
canShow: { basic: boolean; rotation: boolean; weight: boolean; rect: boolean };
|
|
72
|
+
resetOrientation: boolean;
|
|
73
|
+
backToNorthDuringAutoElevation: boolean;
|
|
74
|
+
animation: {
|
|
75
|
+
autoElevation: boolean;
|
|
76
|
+
consecutive: boolean;
|
|
77
|
+
operationCompletion: boolean;
|
|
78
|
+
};
|
|
79
|
+
referencePoint: { supported: boolean; gestures: CameraReferenceGesture[] };
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export type AdvancedCameraState = HeightCameraPosition & { zoomLevel: number };
|
|
83
|
+
|
|
84
|
+
export type AdvancedCameraCommandResult =
|
|
85
|
+
| { type: 'capabilities'; capabilities: AdvancedCameraCapabilities }
|
|
86
|
+
| { type: 'state'; camera: AdvancedCameraState }
|
|
87
|
+
| { type: 'dispatched'; operationId?: string }
|
|
88
|
+
| { type: 'canShow'; value: boolean }
|
|
89
|
+
| { type: 'heightAtLevel'; height: number }
|
|
90
|
+
| { type: 'applied' };
|
|
91
|
+
|
|
92
|
+
export type AdvancedCameraOperationEvent = {
|
|
93
|
+
operationId: string;
|
|
94
|
+
status: 'completed' | 'superseded';
|
|
95
|
+
/** Actual SDK state at the time the event was emitted. */
|
|
96
|
+
camera?: AdvancedCameraState;
|
|
97
|
+
};
|
package/src/types-dim.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
GeographicPolygonGeometry,
|
|
3
|
+
ModelPolygonGeometry,
|
|
4
|
+
PolygonStyleSet,
|
|
5
|
+
ShapeWaveAnimation,
|
|
6
|
+
} from './types-shapes';
|
|
7
|
+
|
|
8
|
+
export type DimScreenCover = 'map' | 'mapAndRoute' | 'mapAndLabel' | 'all';
|
|
9
|
+
|
|
10
|
+
export type DimScreenHighlight = {
|
|
11
|
+
id: string;
|
|
12
|
+
styleSetId: string;
|
|
13
|
+
geometry: GeographicPolygonGeometry | ModelPolygonGeometry;
|
|
14
|
+
visible?: boolean;
|
|
15
|
+
zIndex?: number;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type DimScreenOptions = {
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
color: string;
|
|
21
|
+
/** iOS SDK 2.12.19 does not support `mapAndRoute`. */
|
|
22
|
+
cover: DimScreenCover;
|
|
23
|
+
/** Android only; the iOS dim screen has no z-order property. */
|
|
24
|
+
zIndex?: number;
|
|
25
|
+
styleSets?: PolygonStyleSet[];
|
|
26
|
+
highlights?: DimScreenHighlight[];
|
|
27
|
+
animations?: ShapeWaveAnimation[];
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type DimScreenStatus = {
|
|
31
|
+
/** Null when the platform SDK exposes no getter for the applied configuration. */
|
|
32
|
+
enabled: boolean | null;
|
|
33
|
+
color: string | null;
|
|
34
|
+
cover: DimScreenCover | null;
|
|
35
|
+
highlights: {
|
|
36
|
+
id: string;
|
|
37
|
+
visible: boolean;
|
|
38
|
+
geometryType: DimScreenHighlight['geometry']['type'];
|
|
39
|
+
}[];
|
|
40
|
+
/** `running` is null when the native SDK does not expose animator state. */
|
|
41
|
+
animations: { id: string; running: boolean | null }[];
|
|
42
|
+
counts: { highlights: number; animations: number };
|
|
43
|
+
capabilities: {
|
|
44
|
+
coversRoute: boolean;
|
|
45
|
+
modelHighlights: boolean;
|
|
46
|
+
modelOrientation: boolean;
|
|
47
|
+
animations: boolean;
|
|
48
|
+
animationDuration: boolean;
|
|
49
|
+
animationState: boolean;
|
|
50
|
+
nativeConfigurationState: boolean;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type DimScreenEvent = { type: 'animationStopped'; id: string };
|