@react-native-kakao/map 2.2.6 → 3.1.0-next.2
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 +14 -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/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# @react-native-kakao/map
|
|
2
|
+
|
|
3
|
+
## 3.1.0-next.2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- c86587c: Add an independent Expo Module for Kakao Maps on Android and iOS, with camera control, lifecycle events, and explicit initialization.
|
|
8
|
+
- 0422fad: Add map presentation options, projection helpers, camera updates, and advanced camera controls with platform capabilities.
|
|
9
|
+
- eb54ea5: Add route rendering, progress animations, replacement, and route command APIs.
|
|
10
|
+
- bdd3dd1: Add dim screen highlights, visibility controls, and animation commands.
|
|
11
|
+
- a2f659e: Add map utilities for coordinates, POI state, viewport, fonts, cache, and version queries.
|
|
12
|
+
- af79548: Add GUI sprites, info windows, widgets, image sizing, events, and animation controls.
|
|
13
|
+
- 34dfbfc: Add label scenes, image loading, events, commands, animations, and platform capability reporting.
|
|
14
|
+
- bc7242d: Add geographic and model shape scenes, commands, animations, and label-to-shape transform sharing.
|
package/README.md
CHANGED
|
@@ -1,42 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
<a href="https://rnkakao.dev">
|
|
3
|
-
<img width="160px" src="https://raw.githubusercontent.com/mym0404/image-archive/master/202404201234177.webp"><br/>
|
|
4
|
-
</a>
|
|
5
|
-
<h1 align="center">React Native Kakao Map</h1>
|
|
6
|
-
<p align="center">
|
|
7
|
-
<a href="https://www.npmjs.com/package/@react-native-kakao/core"><img src="https://img.shields.io/npm/dm/@react-native-kakao/core.svg?style=flat-square" alt="NPM downloads"></a>
|
|
8
|
-
<a href="https://www.npmjs.com/package/@react-native-kakao/core"><img src="https://img.shields.io/npm/v/@react-native-kakao/core.svg?style=flat-square" alt="NPM version"></a>
|
|
9
|
-
<a href="/LICENSE"><img src="https://img.shields.io/npm/l/@react-native-kakao/core.svg?style=flat-square" alt="License"></a>
|
|
10
|
-
<a href="https://github.com/lerna-lite/lerna-lite"><img src="https://img.shields.io/badge/maintained%20with-lerna--lite-e137ff?style=flat-square" alt="License"></a>
|
|
11
|
-
<h3 align="center">Native Kakao SDK All In One Solution</h3>
|
|
12
|
-
</p>
|
|
13
|
-
</p>
|
|
14
|
-
<a href="https://rnkakao.dev">Documentation</a>
|
|
1
|
+
# React Native Kakao Map
|
|
15
2
|
|
|
3
|
+
Native Kakao Maps for Android and iOS, implemented with Expo Modules. Requires Expo 52+, React Native 0.76+, and the New Architecture. Core is not required.
|
|
16
4
|
|
|
17
|
-
|
|
5
|
+
See the [installation and API guide](https://rnkakao.mjstudio.net/docs/map/intro).
|
|
18
6
|
|
|
19
|
-
|
|
7
|
+
Kakao Maps SDK versions: Android 2.15.2 and iOS 2.12.19. Use a native development or Release build; Expo Go and web maps are unsupported. Android map runtime requires an ARM device or emulator.
|
|
20
8
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- [Contributing](https://github.com/mym0404/react-native-kakao/blob/main/CONTRIBUTING.md)
|
|
24
|
-
- [Issues](https://github.com/mym0404/react-native-kakao/issues)
|
|
25
|
-
- [PRs](https://github.com/mym0404/react-native-kakao/pulls)
|
|
26
|
-
- [Documentation](https://rnkakao.dev)
|
|
27
|
-
- [Code of Conduct](https://github.com/mym0404/react-native-kakao/blob/main/CODE_OF_CONDUCT.md)
|
|
28
|
-
|
|
29
|
-
## License
|
|
30
|
-
|
|
31
|
-
- See [LICENSE](/LICENSE)
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
<p align="center">
|
|
36
|
-
<a href="https://mjstudio.net/">
|
|
37
|
-
<img width="75px" src="https://raw.githubusercontent.com/mym0404/image-archive/master/202404201239152.webp">
|
|
38
|
-
</a>
|
|
39
|
-
<p align="center">
|
|
40
|
-
Built and maintained by <a href="https://mjstudio.net/">MJ Studio</a>.
|
|
41
|
-
</p>
|
|
42
|
-
</p>
|
|
9
|
+
Licensed under MIT. The underlying Kakao SDK is subject to Kakao's terms.
|
package/RNCKakaoMap.podspec
CHANGED
|
@@ -1,56 +1,20 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'json'
|
|
2
2
|
|
|
3
|
-
package = JSON.parse(File.read(File.join(__dir__,
|
|
4
|
-
corePackage = JSON.parse(File.read(File.join(__dir__, "..", "core", "package.json")))
|
|
5
|
-
sdk_version = corePackage['sdkVersions']['ios']['map']
|
|
6
|
-
|
|
7
|
-
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
8
4
|
|
|
9
5
|
Pod::Spec.new do |s|
|
|
10
|
-
s.name
|
|
11
|
-
s.version
|
|
12
|
-
s.summary
|
|
13
|
-
s.homepage
|
|
14
|
-
s.license
|
|
15
|
-
s.
|
|
16
|
-
|
|
17
|
-
s.platforms
|
|
18
|
-
s.
|
|
19
|
-
|
|
20
|
-
s.source_files =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if respond_to?(:install_modules_dependencies, true)
|
|
25
|
-
install_modules_dependencies(s)
|
|
26
|
-
else
|
|
27
|
-
s.dependency "React-Core"
|
|
28
|
-
|
|
29
|
-
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
30
|
-
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
31
|
-
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
32
|
-
s.pod_target_xcconfig = {
|
|
33
|
-
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
34
|
-
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
35
|
-
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
36
|
-
}
|
|
37
|
-
s.dependency "React-RCTFabric"
|
|
38
|
-
s.dependency "React-Codegen"
|
|
39
|
-
s.dependency "RCT-Folly"
|
|
40
|
-
s.dependency "RCTRequired"
|
|
41
|
-
s.dependency "RCTTypeSafety"
|
|
42
|
-
s.dependency "ReactCommon/turbomodule/core"
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
# Override Version by User
|
|
47
|
-
if defined?($KakaoMapSDKVersion)
|
|
48
|
-
Pod::UI.puts "#{s.name}: Using user specified Kakao SDK version '#{$KakaoMapSDKVersion}'"
|
|
49
|
-
sdk_version = $KakaoMapSDKVersion
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
s.dependency 'RNCKakaoCore'
|
|
53
|
-
|
|
54
|
-
# Kakao dependencies
|
|
55
|
-
s.dependency 'KakaoMapsSDK', sdk_version
|
|
6
|
+
s.name = 'RNCKakaoMap'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.homepage = package['homepage']
|
|
10
|
+
s.license = package['license']
|
|
11
|
+
s.author = package['author']
|
|
12
|
+
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
|
+
s.platforms = { :ios => '15.1' }
|
|
14
|
+
s.swift_version = '5.4'
|
|
15
|
+
s.static_framework = true
|
|
16
|
+
s.source_files = 'ios/**/*.swift'
|
|
17
|
+
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
|
|
18
|
+
s.dependency 'ExpoModulesCore'
|
|
19
|
+
s.dependency 'KakaoMapsSDK', '2.12.19'
|
|
56
20
|
end
|
package/android/build.gradle
CHANGED
|
@@ -1,117 +1,22 @@
|
|
|
1
|
-
apply
|
|
2
|
-
def Versions = project.ext.RNCKakaoSdkVersions
|
|
3
|
-
Project coreProject = project.ext.getWorkspaceProject("core")
|
|
1
|
+
apply plugin: 'com.android.library'
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
def expoModulesCorePlugin = new File(project(':expo-modules-core').projectDir, 'ExpoModulesCorePlugin.gradle')
|
|
4
|
+
apply from: expoModulesCorePlugin
|
|
5
|
+
applyKotlinExpoModulesCorePlugin()
|
|
6
|
+
useCoreDependencies()
|
|
7
|
+
useDefaultAndroidSdkVersions()
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
mavenCentral()
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
dependencies {
|
|
15
|
-
classpath "com.android.tools.build:gradle:7.2.1"
|
|
16
|
-
// noinspection DifferentKotlinGradleVersion
|
|
17
|
-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
def isNewArchitectureEnabled() {
|
|
22
|
-
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
apply plugin: "com.android.library"
|
|
26
|
-
apply plugin: "kotlin-android"
|
|
27
|
-
|
|
28
|
-
if (isNewArchitectureEnabled()) {
|
|
29
|
-
apply plugin: "com.facebook.react"
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
def supportsNamespace() {
|
|
33
|
-
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
34
|
-
def major = parsed[0].toInteger()
|
|
35
|
-
def minor = parsed[1].toInteger()
|
|
36
|
-
|
|
37
|
-
// Namespace support was added in 7.3.0
|
|
38
|
-
return (major == 7 && minor >= 3) || major >= 8
|
|
39
|
-
}
|
|
9
|
+
group = 'net.mjstudio.rnkakao.map'
|
|
10
|
+
version = '3.0.0'
|
|
40
11
|
|
|
41
12
|
android {
|
|
42
|
-
|
|
43
|
-
namespace "net.mjstudio.rnkakao.map"
|
|
44
|
-
|
|
45
|
-
sourceSets {
|
|
46
|
-
main {
|
|
47
|
-
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
compileSdkVersion Versions.compileSdk
|
|
53
|
-
|
|
13
|
+
namespace 'net.mjstudio.rnkakao.map'
|
|
54
14
|
defaultConfig {
|
|
55
|
-
|
|
56
|
-
targetSdkVersion Versions.targetSdk
|
|
57
|
-
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
15
|
+
consumerProguardFiles 'consumer-rules.pro'
|
|
58
16
|
}
|
|
59
|
-
|
|
60
|
-
buildFeatures {
|
|
61
|
-
buildConfig true
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
buildTypes {
|
|
65
|
-
release {
|
|
66
|
-
minifyEnabled false
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
lintOptions {
|
|
71
|
-
disable "GradleCompatible"
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
compileOptions {
|
|
75
|
-
sourceCompatibility JavaVersion.VERSION_1_8
|
|
76
|
-
targetCompatibility JavaVersion.VERSION_1_8
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
sourceSets {
|
|
81
|
-
main {
|
|
82
|
-
if (isNewArchitectureEnabled()) {
|
|
83
|
-
java.srcDirs += [
|
|
84
|
-
"src/newarch",
|
|
85
|
-
// This is needed to build Kotlin project with NewArch enabled
|
|
86
|
-
"${project.buildDir}/generated/source/codegen/java"
|
|
87
|
-
]
|
|
88
|
-
} else {
|
|
89
|
-
java.srcDirs += ["src/oldarch"]
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
repositories {
|
|
96
|
-
mavenCentral()
|
|
97
|
-
google()
|
|
98
17
|
}
|
|
99
18
|
|
|
100
19
|
dependencies {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
//noinspection GradleDynamicVersion
|
|
104
|
-
implementation "com.facebook.react:react-native:+"
|
|
105
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}"
|
|
106
|
-
|
|
107
|
-
api coreProject
|
|
108
|
-
implementation "com.kakao.maps.open:android:${Versions.map}"
|
|
20
|
+
implementation 'com.facebook.react:react-android'
|
|
21
|
+
implementation 'com.kakao.maps.open:android:2.15.2'
|
|
109
22
|
}
|
|
110
|
-
|
|
111
|
-
if (isNewArchitectureEnabled()) {
|
|
112
|
-
react {
|
|
113
|
-
jsRootDir = file("../src/")
|
|
114
|
-
libraryName = "RNCKakaoMap"
|
|
115
|
-
codegenJavaPackageName = "net.mjstudio.rnkakao.map"
|
|
116
|
-
}
|
|
117
|
-
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
package net.mjstudio.rnkakao.map
|
|
2
|
+
|
|
3
|
+
import com.kakao.vectormap.LatLng
|
|
4
|
+
import com.kakao.vectormap.camera.CameraPosition
|
|
5
|
+
import expo.modules.kotlin.exception.CodedException
|
|
6
|
+
import expo.modules.kotlin.records.Field
|
|
7
|
+
import expo.modules.kotlin.records.Record
|
|
8
|
+
import expo.modules.kotlin.records.Required
|
|
9
|
+
|
|
10
|
+
internal const val INVALID_ARGUMENT = "ERR_KAKAO_MAP_INVALID_ARGUMENT"
|
|
11
|
+
internal const val NOT_INITIALIZED = "ERR_KAKAO_MAP_NOT_INITIALIZED"
|
|
12
|
+
internal const val NOT_READY = "ERR_KAKAO_MAP_NOT_READY"
|
|
13
|
+
|
|
14
|
+
class CameraOptions : Record {
|
|
15
|
+
@Field @Required
|
|
16
|
+
var latitude: Double = Double.NaN
|
|
17
|
+
|
|
18
|
+
@Field @Required
|
|
19
|
+
var longitude: Double = Double.NaN
|
|
20
|
+
|
|
21
|
+
@Field @Required
|
|
22
|
+
var zoomLevel: Double = Double.NaN
|
|
23
|
+
|
|
24
|
+
@Field var tilt: Double = 0.0
|
|
25
|
+
|
|
26
|
+
@Field var rotation: Double = 0.0
|
|
27
|
+
|
|
28
|
+
fun values() = listOf(latitude, longitude, zoomLevel, tilt, rotation)
|
|
29
|
+
|
|
30
|
+
fun position(
|
|
31
|
+
minZoom: Int,
|
|
32
|
+
maxZoom: Int,
|
|
33
|
+
): CameraPosition {
|
|
34
|
+
if (!values().all { it.isFinite() } || latitude !in -90.0..90.0 || longitude !in -180.0..180.0 ||
|
|
35
|
+
zoomLevel % 1.0 != 0.0 || zoomLevel < minZoom || zoomLevel > maxZoom || tilt !in 0.0..90.0
|
|
36
|
+
) {
|
|
37
|
+
throw CodedException(INVALID_ARGUMENT, "Invalid camera coordinates, zoom level, tilt, or rotation.", null)
|
|
38
|
+
}
|
|
39
|
+
return CameraPosition.from(
|
|
40
|
+
CameraPosition
|
|
41
|
+
.Builder()
|
|
42
|
+
.setPosition(LatLng.from(latitude, longitude))
|
|
43
|
+
.setZoomLevel(zoomLevel.toInt())
|
|
44
|
+
.setTiltAngle(Math.toRadians(tilt))
|
|
45
|
+
.setRotationAngle(rotation.toNativeCameraRotation()),
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
internal fun CameraPosition.toPayload() =
|
|
51
|
+
mapOf(
|
|
52
|
+
"latitude" to position.latitude,
|
|
53
|
+
"longitude" to position.longitude,
|
|
54
|
+
"zoomLevel" to zoomLevel,
|
|
55
|
+
"tilt" to Math.toDegrees(tiltAngle),
|
|
56
|
+
"rotation" to Math.toDegrees(rotationAngle).normalizedCameraDegrees(),
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
internal fun Double.toNativeCameraRotation() = Math.toRadians(normalizedCameraDegrees())
|
|
60
|
+
|
|
61
|
+
internal fun Double.normalizedCameraDegrees() = (this % 360.0 + 360.0) % 360.0
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
package net.mjstudio.rnkakao.map
|
|
2
|
+
|
|
3
|
+
import com.kakao.vectormap.KakaoMapSdk
|
|
4
|
+
import expo.modules.kotlin.Promise
|
|
5
|
+
import expo.modules.kotlin.exception.CodedException
|
|
6
|
+
import expo.modules.kotlin.functions.Queues
|
|
7
|
+
import expo.modules.kotlin.modules.Module
|
|
8
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
9
|
+
|
|
10
|
+
class KakaoMapModule : Module() {
|
|
11
|
+
override fun definition() =
|
|
12
|
+
ModuleDefinition {
|
|
13
|
+
Name("RNCKakaoMap")
|
|
14
|
+
AsyncFunction("initialize") { key: String ->
|
|
15
|
+
if (key.isBlank()) throw CodedException(INVALID_ARGUMENT, "App key must not be empty.", null)
|
|
16
|
+
if (appKey != null &&
|
|
17
|
+
appKey != key
|
|
18
|
+
) {
|
|
19
|
+
throw CodedException("ERR_KAKAO_MAP_ALREADY_INITIALIZED", "Kakao Maps is already initialized with another key.", null)
|
|
20
|
+
}
|
|
21
|
+
if (appKey == null) {
|
|
22
|
+
KakaoMapSdk.init(appContext.reactContext ?: throw CodedException("React context is unavailable."), key)
|
|
23
|
+
appKey = key
|
|
24
|
+
}
|
|
25
|
+
}.runOnQueue(Queues.MAIN)
|
|
26
|
+
View(KakaoMapView::class) {
|
|
27
|
+
Events(
|
|
28
|
+
"onMapReady",
|
|
29
|
+
"onError",
|
|
30
|
+
"onCameraMoveStart",
|
|
31
|
+
"onCameraIdle",
|
|
32
|
+
"onMapClick",
|
|
33
|
+
"onMapLongClick",
|
|
34
|
+
"onTerrainClick",
|
|
35
|
+
"onViewportClick",
|
|
36
|
+
"onVisibilityChanged",
|
|
37
|
+
"onFocusChanged",
|
|
38
|
+
"onPoiClick",
|
|
39
|
+
"onCompassClick",
|
|
40
|
+
"onMapTypeChanged",
|
|
41
|
+
"onPaddingChanged",
|
|
42
|
+
"onViewportChanged",
|
|
43
|
+
"onLabelClick",
|
|
44
|
+
"onLabelAnimationStopped",
|
|
45
|
+
"onLabelsChanged",
|
|
46
|
+
"onShapeAnimationStop",
|
|
47
|
+
"onShapesChanged",
|
|
48
|
+
"onRoutesChanged",
|
|
49
|
+
"onRouteProgress",
|
|
50
|
+
"onRouteAnimationStop",
|
|
51
|
+
"onGuiEvent",
|
|
52
|
+
"onDimScreenEvent",
|
|
53
|
+
"onCameraOperation",
|
|
54
|
+
)
|
|
55
|
+
Prop("initialCamera") { view: KakaoMapView, camera: CameraOptions? -> view.pendingInitialCamera = camera }
|
|
56
|
+
Prop("camera") { view: KakaoMapView, camera: CameraOptions? -> view.camera = camera }
|
|
57
|
+
Prop("options") { view: KakaoMapView, options: MapOptionsRecord? -> view.pendingOptions = options }
|
|
58
|
+
Prop("labels") { view: KakaoMapView, scene: MapLabelSceneRecord? -> view.queueLabels(scene) }
|
|
59
|
+
Prop("shapes") { view: KakaoMapView, scene: Map<String, Any?>? -> view.queueShapes(scene) }
|
|
60
|
+
Prop("routes") { view: KakaoMapView, scene: Map<String, Any?>? -> view.queueRoutes(scene) }
|
|
61
|
+
OnViewDidUpdateProps { view: KakaoMapView -> view.updateProps() }
|
|
62
|
+
AsyncFunction("moveCamera") { view: KakaoMapView, camera: CameraOptions, duration: Double -> view.moveCamera(camera, duration) }
|
|
63
|
+
AsyncFunction("getCamera") { view: KakaoMapView, promise: Promise -> view.getCamera(promise) }
|
|
64
|
+
AsyncFunction("updateCamera") { view: KakaoMapView, update: CameraUpdateRecord, duration: Double, promise: Promise ->
|
|
65
|
+
view.updateCamera(update, duration, promise)
|
|
66
|
+
}
|
|
67
|
+
AsyncFunction("getMapInfo") { view: KakaoMapView -> view.getMapInfo() }
|
|
68
|
+
AsyncFunction("screenToCoordinate") { view: KakaoMapView, point: ScreenPointRecord -> view.screenToCoordinate(point) }
|
|
69
|
+
AsyncFunction("coordinateToScreen") { view: KakaoMapView, coordinate: CoordinateRecord ->
|
|
70
|
+
view.coordinateToScreen(coordinate)
|
|
71
|
+
}
|
|
72
|
+
AsyncFunction("clearCache") { view: KakaoMapView -> view.clearCache() }
|
|
73
|
+
AsyncFunction("runLabelCommand") { view: KakaoMapView, command: MapLabelCommandRecord -> view.runLabelCommand(command) }
|
|
74
|
+
AsyncFunction("getLabelCapabilities") { view: KakaoMapView -> view.getLabelCapabilities() }
|
|
75
|
+
AsyncFunction("getLabelState") { view: KakaoMapView -> view.getLabelState() }
|
|
76
|
+
AsyncFunction("applyShapes") { view: KakaoMapView, scene: Map<String, Any?> -> view.applyShapes(scene) }
|
|
77
|
+
.runOnQueue(Queues.MAIN)
|
|
78
|
+
AsyncFunction("executeShapeCommand") { view: KakaoMapView, command: Map<String, Any?> ->
|
|
79
|
+
view.executeShapeCommand(command)
|
|
80
|
+
}.runOnQueue(Queues.MAIN)
|
|
81
|
+
AsyncFunction("applyRoutes") { view: KakaoMapView, scene: Map<String, Any?>, promise: Promise -> view.applyRoutes(scene, promise) }
|
|
82
|
+
AsyncFunction("executeRouteCommand") { view: KakaoMapView, command: Map<String, Any?> -> view.executeRouteCommand(command) }
|
|
83
|
+
AsyncFunction("applyGui") { view: KakaoMapView, scene: MapGuiSceneRecord, promise: Promise ->
|
|
84
|
+
view.requireGui().apply(scene) { error ->
|
|
85
|
+
if (error != null) promise.reject(error) else promise.resolve(null)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
AsyncFunction("showInfoWindow") { view: KakaoMapView, id: String, autoMove: Boolean, duration: Double? ->
|
|
89
|
+
view.requireGui().showInfoWindow(id, autoMove, duration)
|
|
90
|
+
}
|
|
91
|
+
AsyncFunction("hideInfoWindow") { view: KakaoMapView, id: String -> view.requireGui().hideInfoWindow(id) }
|
|
92
|
+
AsyncFunction("moveInfoWindow") { view: KakaoMapView, id: String, position: CoordinateRecord, duration: Double ->
|
|
93
|
+
view.requireGui().moveInfoWindow(id, position, duration)
|
|
94
|
+
}
|
|
95
|
+
AsyncFunction("showWidget") { view: KakaoMapView, id: String -> view.requireGui().showWidget(id) }
|
|
96
|
+
AsyncFunction("hideWidget") { view: KakaoMapView, id: String -> view.requireGui().hideWidget(id) }
|
|
97
|
+
AsyncFunction(
|
|
98
|
+
"positionWidget",
|
|
99
|
+
) { view: KakaoMapView, id: String, position: MapWidgetPositionRecord -> view.requireGui().positionWidget(id, position) }
|
|
100
|
+
AsyncFunction("rotateWidget") { view: KakaoMapView, id: String, rotation: Double -> view.requireGui().rotateWidget(id, rotation) }
|
|
101
|
+
AsyncFunction("startGuiAnimation") { view: KakaoMapView, id: String -> view.requireGui().startAnimation(id) }
|
|
102
|
+
AsyncFunction("stopGuiAnimation") { view: KakaoMapView, id: String -> view.requireGui().stopAnimation(id) }
|
|
103
|
+
AsyncFunction(
|
|
104
|
+
"controlAnimatedImage",
|
|
105
|
+
) { view: KakaoMapView, ownerType: String, ownerId: String, componentId: String, action: String ->
|
|
106
|
+
view.requireGui().controlAnimatedImage(ownerType, ownerId, componentId, action)
|
|
107
|
+
}
|
|
108
|
+
AsyncFunction("getGuiStatus") { view: KakaoMapView -> view.requireGui().status() }
|
|
109
|
+
AsyncFunction("applyDimScreen") { view: KakaoMapView, options: Map<String, Any?> -> view.requireDimScreen().apply(options) }
|
|
110
|
+
AsyncFunction(
|
|
111
|
+
"setDimHighlightVisible",
|
|
112
|
+
) { view: KakaoMapView, id: String, visible: Boolean -> view.requireDimScreen().setHighlightVisible(id, visible) }
|
|
113
|
+
AsyncFunction("startDimAnimation") { view: KakaoMapView, id: String -> view.requireDimScreen().startAnimation(id) }
|
|
114
|
+
AsyncFunction("stopDimAnimation") { view: KakaoMapView, id: String -> view.requireDimScreen().stopAnimation(id) }
|
|
115
|
+
AsyncFunction("getDimScreenStatus") { view: KakaoMapView -> view.requireDimScreen().status() }
|
|
116
|
+
AsyncFunction(
|
|
117
|
+
"executeUtilityCommand",
|
|
118
|
+
) { view: KakaoMapView, command: Map<String, Any?> -> view.requireUtilities().command(command) }
|
|
119
|
+
AsyncFunction("requestPoiState") { view: KakaoMapView, promise: Promise -> view.requireUtilities().requestPoiState(promise) }
|
|
120
|
+
AsyncFunction(
|
|
121
|
+
"executeCameraCommand",
|
|
122
|
+
) { view: KakaoMapView, command: Map<String, Any?>, promise: Promise -> view.executeCameraCommand(command, promise) }
|
|
123
|
+
OnViewDestroys { view: KakaoMapView -> view.destroy() }
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
companion object {
|
|
128
|
+
var appKey: String? = null
|
|
129
|
+
private set
|
|
130
|
+
}
|
|
131
|
+
}
|