-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from mym0404/map-ios
Kakao Map Implementation
- Loading branch information
Showing
38 changed files
with
1,470 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { useState } from 'react'; | ||
import KakaoMapView from '@react-native-kakao/map'; | ||
import type { Camera } from '@react-native-kakao/map/src/type/type'; | ||
|
||
import { Box } from '../component/Box'; | ||
import { Btn } from '../component/Btn'; | ||
import { px } from '../util/px'; | ||
|
||
const Cameras = { | ||
Seolleung: { | ||
lat: 37.50497126, | ||
lng: 127.04905021, | ||
zoomLevel: 14, | ||
}, | ||
Gangnam: { | ||
lat: 37.498040483, | ||
lng: 127.02758183, | ||
zoomLevel: 14, | ||
}, | ||
Jeju: { | ||
lat: 33.39530773, | ||
lng: 126.54656715029, | ||
zoomLevel: 8, | ||
}, | ||
} satisfies Record<string, Camera>; | ||
|
||
export default function Page() { | ||
const [camera, setCamera] = useState<Camera>(Cameras.Gangnam); | ||
|
||
return ( | ||
<Box flex={1} gap={8}> | ||
<KakaoMapView | ||
style={{ flex: 1 }} | ||
buildingScale={0.5} | ||
poiEnabled | ||
poiScale={'regular'} | ||
baseMapType={'map'} | ||
camera={camera} | ||
cameraAnimationDuration={1500} | ||
/> | ||
<Box h={px(200)} bg={'white'}> | ||
<Btn title={'Gangnam'} onPress={() => setCamera(Cameras.Gangnam)} /> | ||
<Btn title={'Seolleung'} onPress={() => setCamera(Cameras.Seolleung)} /> | ||
</Box> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 MJ Studio | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<p align="center"> | ||
<a href="https://rnkakao.dev"> | ||
<img width="160px" src="https://raw.githubusercontent.com/mym0404/image-archive/master/202404201234177.webp"><br/> | ||
</a> | ||
<h1 align="center">React Native Kakao Map</h1> | ||
<p align="center"> | ||
<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> | ||
<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> | ||
<a href="/LICENSE"><img src="https://img.shields.io/npm/l/@react-native-kakao/core.svg?style=flat-square" alt="License"></a> | ||
<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> | ||
<h3 align="center">Native Kakao SDK All In One Solution</h3> | ||
</p> | ||
</p> | ||
<a href="https://rnkakao.dev">Documentation</a> | ||
|
||
|
||
## Documentation | ||
|
||
- [Quick Start](https://rnkakao.dev) | ||
|
||
## Contributing | ||
|
||
- [Contributing](https://github.com/mym0404/react-native-kakao/blob/main/CONTRIBUTING.md) | ||
- [Issues](https://github.com/mym0404/react-native-kakao/issues) | ||
- [PRs](https://github.com/mym0404/react-native-kakao/pulls) | ||
- [Documentation](https://rnkakao.dev) | ||
- [Code of Conduct](https://github.com/mym0404/react-native-kakao/blob/main/CODE_OF_CONDUCT.md) | ||
|
||
## License | ||
|
||
- See [LICENSE](/LICENSE) | ||
|
||
--- | ||
|
||
<p align="center"> | ||
<a href="https://mjstudio.net/"> | ||
<img width="75px" src="https://raw.githubusercontent.com/mym0404/image-archive/master/202404201239152.webp"> | ||
</a> | ||
<p align="center"> | ||
Built and maintained by <a href="https://mjstudio.net/">MJ Studio</a>. | ||
</p> | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
require "json" | ||
|
||
package = JSON.parse(File.read(File.join(__dir__, "package.json"))) | ||
corePackage = JSON.parse(File.read(File.join(__dir__, "..", "core", "package.json"))) | ||
sdk_version = corePackage['sdkVersions']['ios']['map'] | ||
|
||
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' | ||
|
||
Pod::Spec.new do |s| | ||
s.name = "RNCKakaoMap" | ||
s.version = package["version"] | ||
s.summary = package["description"] | ||
s.homepage = package["homepage"] | ||
s.license = package["license"] | ||
s.authors = package["author"] | ||
|
||
s.platforms = { :ios => min_ios_version_supported } | ||
s.source = { :git => "https://github.com/mym0404/react-native-kakao.git", :tag => "#{s.version}" } | ||
|
||
s.source_files = "ios/**/*.{h,m,mm}" | ||
|
||
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0. | ||
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79. | ||
if respond_to?(:install_modules_dependencies, true) | ||
install_modules_dependencies(s) | ||
else | ||
s.dependency "React-Core" | ||
|
||
# Don't install the dependencies when we run `pod install` in the old architecture. | ||
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then | ||
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1" | ||
s.pod_target_xcconfig = { | ||
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"", | ||
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1", | ||
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17" | ||
} | ||
s.dependency "React-RCTFabric" | ||
s.dependency "React-Codegen" | ||
s.dependency "RCT-Folly" | ||
s.dependency "RCTRequired" | ||
s.dependency "RCTTypeSafety" | ||
s.dependency "ReactCommon/turbomodule/core" | ||
end | ||
end | ||
|
||
# Override Version by User | ||
if defined?($KakaoMapSDKVersion) | ||
Pod::UI.puts "#{s.name}: Using user specified Kakao SDK version '#{$KakaoMapSDKVersion}'" | ||
sdk_version = $KakaoMapSDKVersion | ||
end | ||
|
||
s.dependency 'RNCKakaoCore' | ||
|
||
# Kakao dependencies | ||
s.dependency 'KakaoMapsSDK', sdk_version | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# editorconfig | ||
root = true | ||
|
||
[*.{kt,kts}] | ||
ktlint_code_style = ktlint_official | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
apply from: file('./../../core/android/package-json.gradle') | ||
def Versions = project.ext.RNCKakaoSdkVersions | ||
Project coreProject = project.ext.getWorkspaceProject("core") | ||
|
||
buildscript { | ||
// Buildscript is evaluated before everything else so we can't use getExtOrDefault | ||
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["Kakao_kotlinVersion"] | ||
|
||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
classpath "com.android.tools.build:gradle:7.2.1" | ||
// noinspection DifferentKotlinGradleVersion | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | ||
} | ||
} | ||
|
||
def isNewArchitectureEnabled() { | ||
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true" | ||
} | ||
|
||
apply plugin: "com.android.library" | ||
apply plugin: "kotlin-android" | ||
|
||
if (isNewArchitectureEnabled()) { | ||
apply plugin: "com.facebook.react" | ||
} | ||
|
||
def supportsNamespace() { | ||
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.') | ||
def major = parsed[0].toInteger() | ||
def minor = parsed[1].toInteger() | ||
|
||
// Namespace support was added in 7.3.0 | ||
return (major == 7 && minor >= 3) || major >= 8 | ||
} | ||
|
||
android { | ||
if (supportsNamespace()) { | ||
namespace "net.mjstudio.rnkakao.map" | ||
|
||
sourceSets { | ||
main { | ||
manifest.srcFile "src/main/AndroidManifestNew.xml" | ||
} | ||
} | ||
} | ||
|
||
compileSdkVersion Versions.compileSdk | ||
|
||
defaultConfig { | ||
minSdkVersion Versions.minSdk | ||
targetSdkVersion Versions.targetSdk | ||
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() | ||
} | ||
|
||
buildFeatures { | ||
buildConfig true | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
} | ||
} | ||
|
||
lintOptions { | ||
disable "GradleCompatible" | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
|
||
|
||
sourceSets { | ||
main { | ||
if (isNewArchitectureEnabled()) { | ||
java.srcDirs += [ | ||
"src/newarch", | ||
// This is needed to build Kotlin project with NewArch enabled | ||
"${project.buildDir}/generated/source/codegen/java" | ||
] | ||
} else { | ||
java.srcDirs += ["src/oldarch"] | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
google() | ||
} | ||
|
||
dependencies { | ||
// For < 0.71, this will be from the local maven repo | ||
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin | ||
//noinspection GradleDynamicVersion | ||
implementation "com.facebook.react:react-native:+" | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}" | ||
|
||
api coreProject | ||
implementation "com.kakao.maps.open:android:${Versions.map}" | ||
} | ||
|
||
if (isNewArchitectureEnabled()) { | ||
react { | ||
jsRootDir = file("../src/") | ||
libraryName = "RNCKakaoMap" | ||
codegenJavaPackageName = "net.mjstudio.rnkakao.map" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Kakao_kotlinVersion=1.7.0 |
Oops, something went wrong.