├── .github
├── ISSUE_TEMPLATE.md
└── workflows
│ └── npmpublish.yml
├── .gitignore
├── LICENSE
├── README.md
├── android
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
└── src
│ ├── debug
│ └── AndroidManifest.xml
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── com
│ ├── airbnb
│ └── android
│ │ └── react
│ │ └── maps
│ │ ├── SizeReportingShadowNode.java
│ │ ├── TrackableView.java
│ │ ├── ViewAttacherGroup.java
│ │ └── ViewChangesTracker.java
│ └── github
│ └── quadflask
│ └── react
│ └── navermap
│ ├── ClickableRNNaverMapFeature.java
│ ├── EventEmittable.java
│ ├── EventEmittableViewGroupManager.java
│ ├── EventEmmitableReactView.java
│ ├── OverlayImages.java
│ ├── RNNaverMapCircleOverlay.java
│ ├── RNNaverMapCircleOverlayManager.java
│ ├── RNNaverMapFeature.java
│ ├── RNNaverMapJavaModule.java
│ ├── RNNaverMapMarker.java
│ ├── RNNaverMapMarkerManager.java
│ ├── RNNaverMapPackage.java
│ ├── RNNaverMapPathOverlay.java
│ ├── RNNaverMapPathOverlayManager.java
│ ├── RNNaverMapPolygonOverlay.java
│ ├── RNNaverMapPolygonOverlayManager.java
│ ├── RNNaverMapPolylineOverlay.java
│ ├── RNNaverMapPolylineOverlayManager.java
│ ├── RNNaverMapView.java
│ ├── RNNaverMapViewContainer.java
│ ├── RNNaverMapViewManager.java
│ ├── RNNaverMapViewProps.java
│ ├── RNNaverMapViewTextureManager.java
│ └── ReactUtil.java
├── example
├── .buckconfig
├── .eslintrc.js
├── .flowconfig
├── .gitattributes
├── .gitignore
├── .prettierrc.js
├── .watchmanconfig
├── App.js
├── __tests__
│ └── App-test.js
├── android
│ ├── app
│ │ ├── BUCK
│ │ ├── build.gradle
│ │ ├── build_defs.bzl
│ │ ├── debug.keystore
│ │ ├── proguard-rules.pro
│ │ └── src
│ │ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ │ └── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── MainApplication.java
│ │ │ └── res
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ └── values
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
├── app.json
├── babel.config.js
├── index.js
├── ios
│ ├── Podfile
│ ├── Podfile.lock
│ ├── example-tvOS
│ │ └── Info.plist
│ ├── example-tvOSTests
│ │ └── Info.plist
│ ├── example.xcodeproj
│ │ ├── project.pbxproj
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ ├── example-tvOS.xcscheme
│ │ │ └── example.xcscheme
│ ├── example.xcworkspace
│ │ └── contents.xcworkspacedata
│ ├── example
│ │ ├── AppDelegate.h
│ │ ├── AppDelegate.m
│ │ ├── Base.lproj
│ │ │ └── LaunchScreen.xib
│ │ ├── Images.xcassets
│ │ │ ├── AppIcon.appiconset
│ │ │ │ └── Contents.json
│ │ │ └── Contents.json
│ │ ├── Info.plist
│ │ └── main.m
│ └── exampleTests
│ │ ├── Info.plist
│ │ └── exampleTests.m
├── map
│ ├── index.d.ts
│ └── index.js
├── marker.png
├── metro.config.js
├── package-lock.json
├── package.json
└── screenshot
│ └── screenshot.png
├── index.d.ts
├── index.js
├── index.tsx
├── ios
├── reactNativeNMap.xcodeproj
│ ├── project.pbxproj
│ └── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
└── reactNativeNMap
│ ├── RCTConvert+NMFMapView.h
│ ├── RCTConvert+NMFMapView.m
│ ├── RNNaverMapCircleOverlay.h
│ ├── RNNaverMapCircleOverlay.m
│ ├── RNNaverMapCircleOverlayManager.h
│ ├── RNNaverMapCircleOverlayManager.m
│ ├── RNNaverMapMarker.h
│ ├── RNNaverMapMarker.m
│ ├── RNNaverMapMarkerManager.h
│ ├── RNNaverMapMarkerManager.m
│ ├── RNNaverMapPathOverlay.h
│ ├── RNNaverMapPathOverlay.m
│ ├── RNNaverMapPathOverlayManager.h
│ ├── RNNaverMapPathOverlayManager.m
│ ├── RNNaverMapPolygonOverlay.h
│ ├── RNNaverMapPolygonOverlay.m
│ ├── RNNaverMapPolygonOverlayManager.h
│ ├── RNNaverMapPolygonOverlayManager.m
│ ├── RNNaverMapPolylineOverlay.h
│ ├── RNNaverMapPolylineOverlay.m
│ ├── RNNaverMapPolylineOverlayManager.h
│ ├── RNNaverMapPolylineOverlayManager.m
│ ├── RNNaverMapView.h
│ ├── RNNaverMapView.m
│ └── RNNaverMapViewManager.m
├── package-lock.json
├── package.json
├── react-native-nmap.podspec
└── tsconfig.json
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ### Version of react-native-naver-map libraries
2 |
3 |
4 |
5 | ### Version of react-native
6 |
7 |
8 |
9 | ### Platforms you faced the error (IOS or Android or both?)
10 |
11 |
12 |
13 | ### Expected behavior
14 |
15 |
16 |
17 | ### Actual behavior
18 |
19 |
20 |
21 | ### Tested environment (Emulator? Real Device?)
22 |
23 |
24 |
25 | ### Screen Shot
26 |
27 |
--------------------------------------------------------------------------------
/.github/workflows/npmpublish.yml:
--------------------------------------------------------------------------------
1 | name: react-native-naver-map
2 |
3 | on:
4 | release:
5 | types: [created]
6 |
7 | jobs:
8 | build:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/checkout@v1
12 | - uses: actions/setup-node@v1
13 | with:
14 | node-version: 12
15 | - run: npm i
16 |
17 | publish-npm:
18 | needs: build
19 | runs-on: ubuntu-latest
20 | steps:
21 | - uses: actions/checkout@v1
22 | - uses: actions/setup-node@v1
23 | with:
24 | node-version: 12
25 | registry-url: https://registry.npmjs.org/
26 | - run: npm publish
27 | env:
28 | NODE_AUTH_TOKEN: ${{secrets.npm_token}}
29 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | ### Xcode template
3 | # Xcode
4 | #
5 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
6 |
7 | ## User settings
8 | xcuserdata/
9 |
10 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
11 | *.xcscmblueprint
12 | *.xccheckout
13 |
14 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
15 | build/
16 | Index/
17 | DerivedData/
18 | *.moved-aside
19 | *.pbxuser
20 | !default.pbxuser
21 | *.mode1v3
22 | !default.mode1v3
23 | *.mode2v3
24 | !default.mode2v3
25 | *.perspectivev3
26 | !default.perspectivev3
27 | ### Android template
28 | # Built application files
29 | *.apk
30 | *.ap_
31 |
32 | # Files for the ART/Dalvik VM
33 | *.dex
34 |
35 | # Java class files
36 | *.class
37 |
38 | # Generated files
39 | bin/
40 | gen/
41 | out/
42 |
43 | # Gradle files
44 | .gradle/
45 | build/
46 |
47 | # Local configuration file (sdk path, etc)
48 | local.properties
49 |
50 | # Proguard folder generated by Eclipse
51 | proguard/
52 |
53 | # Log Files
54 | *.log
55 |
56 | # Android Studio Navigation editor temp files
57 | .navigation/
58 |
59 | # Android Studio captures folder
60 | captures/
61 |
62 | # IntelliJ
63 | *.iml
64 | .idea/workspace.xml
65 | .idea/tasks.xml
66 | .idea/gradle.xml
67 | .idea/assetWizardSettings.xml
68 | .idea/dictionaries
69 | .idea/libraries
70 | .idea/caches
71 |
72 | # Keystore files
73 | # Uncomment the following line if you do not want to check your keystore files in.
74 | #*.jks
75 |
76 | # External native build folder generated in Android Studio 2.2 and later
77 | .externalNativeBuild
78 |
79 | # Google Services (e.g. APIs or Firebase)
80 | google-services.json
81 |
82 | # Freeline
83 | freeline.py
84 | freeline/
85 | freeline_project_description.json
86 |
87 | # fastlane
88 | fastlane/report.xml
89 | fastlane/Preview.html
90 | fastlane/screenshots
91 | fastlane/test_output
92 | fastlane/readme.md
93 |
94 | node_modules/
95 |
96 | .idea/
97 |
98 | *.DS_Store
99 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 QuadFlask
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | buildscript {
4 | repositories {
5 | google()
6 | mavenCentral()
7 | }
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:3.4.1'
10 | }
11 | }
12 |
13 | android {
14 | compileSdkVersion rootProject.ext.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
15 | buildToolsVersion rootProject.ext.hasProperty('buildToolsVersion') ? rootProject.ext.buildToolsVersion : "33.0.0"
16 |
17 | defaultConfig {
18 | minSdkVersion rootProject.ext.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 16
19 | targetSdkVersion rootProject.ext.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
20 |
21 | versionCode 1
22 | versionName "1.0"
23 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
24 | }
25 | compileOptions {
26 | sourceCompatibility JavaVersion.VERSION_1_9
27 | targetCompatibility JavaVersion.VERSION_1_9
28 | }
29 | buildTypes {
30 | release {
31 | minifyEnabled false
32 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
33 | }
34 | }
35 | }
36 |
37 | repositories {
38 | mavenLocal()
39 | maven {
40 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
41 | url("$rootDir/../node_modules/react-native/android")
42 | }
43 | maven {
44 | // Android JSC is installed from npm
45 | url("$rootDir/../node_modules/jsc-android/dist")
46 | }
47 | google()
48 | jcenter()
49 | mavenCentral()
50 | maven {
51 | url 'https://naver.jfrog.io/artifactory/maven/'
52 | }
53 | }
54 |
55 | dependencies {
56 | implementation 'com.facebook.react:react-native:+'
57 | implementation "com.naver.maps:map-sdk:${rootProject.ext.hasProperty('mapSdkVersion') ? rootProject.ext.mapSdkVersion : '3.16.0'}"
58 | implementation "com.google.android.gms:play-services-location:16.0.0"
59 | }
60 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | android.useAndroidX=true
21 | android.enableJetifier=true
22 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZeroCho/react-native-naver-map/b2134b45f0db93374863bbb1ead8efc477691c6b/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 | # Determine the Java command to use to start the JVM.
86 | if [ -n "$JAVA_HOME" ] ; then
87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
88 | # IBM's JDK on AIX uses strange locations for the executables
89 | JAVACMD="$JAVA_HOME/jre/sh/java"
90 | else
91 | JAVACMD="$JAVA_HOME/bin/java"
92 | fi
93 | if [ ! -x "$JAVACMD" ] ; then
94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
95 |
96 | Please set the JAVA_HOME variable in your environment to match the
97 | location of your Java installation."
98 | fi
99 | else
100 | JAVACMD="java"
101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
102 |
103 | Please set the JAVA_HOME variable in your environment to match the
104 | location of your Java installation."
105 | fi
106 |
107 | # Increase the maximum file descriptors if we can.
108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
109 | MAX_FD_LIMIT=`ulimit -H -n`
110 | if [ $? -eq 0 ] ; then
111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
112 | MAX_FD="$MAX_FD_LIMIT"
113 | fi
114 | ulimit -n $MAX_FD
115 | if [ $? -ne 0 ] ; then
116 | warn "Could not set maximum file descriptor limit: $MAX_FD"
117 | fi
118 | else
119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
120 | fi
121 | fi
122 |
123 | # For Darwin, add options to specify how the application appears in the dock
124 | if $darwin; then
125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
126 | fi
127 |
128 | # For Cygwin, switch paths to Windows format before running java
129 | if $cygwin ; then
130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
132 | JAVACMD=`cygpath --unix "$JAVACMD"`
133 |
134 | # We build the pattern for arguments to be converted via cygpath
135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
136 | SEP=""
137 | for dir in $ROOTDIRSRAW ; do
138 | ROOTDIRS="$ROOTDIRS$SEP$dir"
139 | SEP="|"
140 | done
141 | OURCYGPATTERN="(^($ROOTDIRS))"
142 | # Add a user-defined pattern to the cygpath arguments
143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
145 | fi
146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
147 | i=0
148 | for arg in "$@" ; do
149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
151 |
152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
154 | else
155 | eval `echo args$i`="\"$arg\""
156 | fi
157 | i=$((i+1))
158 | done
159 | case $i in
160 | (0) set -- ;;
161 | (1) set -- "$args0" ;;
162 | (2) set -- "$args0" "$args1" ;;
163 | (3) set -- "$args0" "$args1" "$args2" ;;
164 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
170 | esac
171 | fi
172 |
173 | # Escape application args
174 | save () {
175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
176 | echo " "
177 | }
178 | APP_ARGS=$(save "$@")
179 |
180 | # Collect all arguments for the java command, following the shell quoting and substitution rules
181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
182 |
183 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
184 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
185 | cd "$(dirname "$0")"
186 | fi
187 |
188 | exec "$JAVACMD" "$@"
189 |
--------------------------------------------------------------------------------
/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem http://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
34 |
35 | @rem Find java.exe
36 | if defined JAVA_HOME goto findJavaFromJavaHome
37 |
38 | set JAVA_EXE=java.exe
39 | %JAVA_EXE% -version >NUL 2>&1
40 | if "%ERRORLEVEL%" == "0" goto init
41 |
42 | echo.
43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
44 | echo.
45 | echo Please set the JAVA_HOME variable in your environment to match the
46 | echo location of your Java installation.
47 |
48 | goto fail
49 |
50 | :findJavaFromJavaHome
51 | set JAVA_HOME=%JAVA_HOME:"=%
52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
53 |
54 | if exist "%JAVA_EXE%" goto init
55 |
56 | echo.
57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
58 | echo.
59 | echo Please set the JAVA_HOME variable in your environment to match the
60 | echo location of your Java installation.
61 |
62 | goto fail
63 |
64 | :init
65 | @rem Get command-line arguments, handling Windows variants
66 |
67 | if not "%OS%" == "Windows_NT" goto win9xME_args
68 |
69 | :win9xME_args
70 | @rem Slurp the command line arguments.
71 | set CMD_LINE_ARGS=
72 | set _SKIP=2
73 |
74 | :win9xME_args_slurp
75 | if "x%~1" == "x" goto execute
76 |
77 | set CMD_LINE_ARGS=%*
78 |
79 | :execute
80 | @rem Setup the command line
81 |
82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
83 |
84 | @rem Execute Gradle
85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
86 |
87 | :end
88 | @rem End local scope for the variables with windows NT shell
89 | if "%ERRORLEVEL%"=="0" goto mainEnd
90 |
91 | :fail
92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
93 | rem the _cmd.exe /c_ return code!
94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
95 | exit /b 1
96 |
97 | :mainEnd
98 | if "%OS%"=="Windows_NT" endlocal
99 |
100 | :omega
101 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'reactNativeNMap'
2 |
--------------------------------------------------------------------------------
/android/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/src/main/java/com/airbnb/android/react/maps/SizeReportingShadowNode.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | * All rights reserved.
4 | * This source code is licensed under the BSD-style license found in the
5 | * LICENSE file in the root directory of this source tree. An additional grant
6 | * of patent rights can be found in the PATENTS file in the same directory.
7 | */
8 |
9 | package com.airbnb.android.react.maps;
10 |
11 | import com.facebook.react.uimanager.LayoutShadowNode;
12 | import com.facebook.react.uimanager.UIViewOperationQueue;
13 |
14 | import java.util.HashMap;
15 | import java.util.Map;
16 |
17 | // Custom LayoutShadowNode implementation used in conjunction with the AirMapManager
18 | // which sends the width/height of the view after layout occurs.
19 | public class SizeReportingShadowNode extends LayoutShadowNode {
20 |
21 | @Override
22 | public void onCollectExtraUpdates(UIViewOperationQueue uiViewOperationQueue) {
23 | super.onCollectExtraUpdates(uiViewOperationQueue);
24 |
25 | Map data = new HashMap<>();
26 | data.put("width", getLayoutWidth());
27 | data.put("height", getLayoutHeight());
28 |
29 | uiViewOperationQueue.enqueueUpdateExtraData(getReactTag(), data);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/android/src/main/java/com/airbnb/android/react/maps/TrackableView.java:
--------------------------------------------------------------------------------
1 | package com.airbnb.android.react.maps;
2 |
3 | public interface TrackableView {
4 | boolean updateCustomForTracking();
5 |
6 | void update(int width, int height);
7 | }
8 |
--------------------------------------------------------------------------------
/android/src/main/java/com/airbnb/android/react/maps/ViewAttacherGroup.java:
--------------------------------------------------------------------------------
1 | package com.airbnb.android.react.maps;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Rect;
6 | import android.os.Build;
7 |
8 | import com.facebook.react.uimanager.ViewProps;
9 | import com.facebook.react.views.view.ReactViewGroup;
10 |
11 | public class ViewAttacherGroup extends ReactViewGroup {
12 |
13 | public ViewAttacherGroup(Context context) {
14 | super(context);
15 |
16 | this.setWillNotDraw(true);
17 | this.setVisibility(VISIBLE);
18 | this.setAlpha(0.0f);
19 | this.setRemoveClippedSubviews(false);
20 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
21 | this.setClipBounds(new Rect(0, 0, 0, 0));
22 | }
23 | this.setOverflow("hidden"); // Change to ViewProps.HIDDEN until RN 0.57 is base
24 | }
25 |
26 | // This should make it more performant, avoid trying to hard to overlap layers with opacity.
27 | @Override
28 | public boolean hasOverlappingRendering() {
29 | return false;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/android/src/main/java/com/airbnb/android/react/maps/ViewChangesTracker.java:
--------------------------------------------------------------------------------
1 | package com.airbnb.android.react.maps;
2 |
3 | import android.os.Handler;
4 | import android.os.Looper;
5 |
6 | import java.util.LinkedList;
7 |
8 | public class ViewChangesTracker {
9 |
10 | private static ViewChangesTracker instance;
11 | private Handler handler;
12 | private LinkedList markers = new LinkedList<>();
13 | private boolean hasScheduledFrame = false;
14 | private Runnable updateRunnable;
15 | private final long fps = 2; // FIXME flickering custom view
16 |
17 | private ViewChangesTracker() {
18 | handler = new Handler(Looper.myLooper());
19 | updateRunnable = () -> {
20 | hasScheduledFrame = false;
21 | update();
22 |
23 | if (markers.size() > 0) {
24 | handler.postDelayed(updateRunnable, 1000 / fps);
25 | }
26 | };
27 | }
28 |
29 | public static ViewChangesTracker getInstance() {
30 | if (instance == null) {
31 | synchronized (ViewChangesTracker.class) {
32 | instance = new ViewChangesTracker();
33 | }
34 | }
35 |
36 | return instance;
37 | }
38 |
39 | public void addMarker(TrackableView marker) {
40 | markers.add(marker);
41 |
42 | if (!hasScheduledFrame) {
43 | hasScheduledFrame = true;
44 | handler.postDelayed(updateRunnable, 1000 / fps);
45 | }
46 | }
47 |
48 | public void removeMarker(TrackableView marker) {
49 | markers.remove(marker);
50 | }
51 |
52 | public boolean containsMarker(TrackableView marker) {
53 | return markers.contains(marker);
54 | }
55 |
56 | private LinkedList markersToRemove = new LinkedList<>();
57 |
58 | public void update() {
59 | for (TrackableView marker : markers) {
60 | if (!marker.updateCustomForTracking()) {
61 | markersToRemove.add(marker);
62 | } else {
63 | marker.update(0, 0);
64 | }
65 | }
66 |
67 | // Remove markers that are not active anymore
68 | if (markersToRemove.size() > 0) {
69 | markers.removeAll(markersToRemove);
70 | markersToRemove.clear();
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/android/src/main/java/com/github/quadflask/react/navermap/ClickableRNNaverMapFeature.java:
--------------------------------------------------------------------------------
1 | package com.github.quadflask.react.navermap;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.annotation.NonNull;
6 |
7 | import com.naver.maps.map.overlay.Overlay;
8 |
9 | public class ClickableRNNaverMapFeature extends RNNaverMapFeature implements Overlay.OnClickListener {
10 | public ClickableRNNaverMapFeature(EventEmittable emitter, Context context) {
11 | super(emitter, context);
12 | }
13 |
14 | @Override
15 | public void addToMap(RNNaverMapView map) {
16 | super.addToMap(map);
17 | feature.setOnClickListener(this);
18 | }
19 |
20 | @Override
21 | public boolean onClick(@NonNull Overlay overlay) {
22 | emitEvent("onClick", null);
23 | return true;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/android/src/main/java/com/github/quadflask/react/navermap/EventEmittable.java:
--------------------------------------------------------------------------------
1 | package com.github.quadflask.react.navermap;
2 |
3 | import com.facebook.react.bridge.ReactContext;
4 | import com.facebook.react.bridge.WritableMap;
5 |
6 | public interface EventEmittable {
7 | boolean emitEvent(ReactContext context, int id, String eventName, WritableMap param);
8 | }
9 |
--------------------------------------------------------------------------------
/android/src/main/java/com/github/quadflask/react/navermap/EventEmittableViewGroupManager.java:
--------------------------------------------------------------------------------
1 | package com.github.quadflask.react.navermap;
2 |
3 | import android.content.Context;
4 | import android.os.Build;
5 | import android.util.DisplayMetrics;
6 | import android.view.ViewGroup;
7 | import android.view.WindowManager;
8 | import com.facebook.react.bridge.ReactApplicationContext;
9 | import com.facebook.react.bridge.ReactContext;
10 | import com.facebook.react.bridge.WritableMap;
11 | import com.facebook.react.common.MapBuilder;
12 | import com.facebook.react.uimanager.ViewGroupManager;
13 | import com.facebook.react.uimanager.events.RCTEventEmitter;
14 |
15 | public abstract class EventEmittableViewGroupManager extends ViewGroupManager
16 | implements EventEmittable {
17 | private final DisplayMetrics metrics;
18 |
19 | public EventEmittableViewGroupManager(ReactApplicationContext reactContext) {
20 | super();
21 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
22 | metrics = new DisplayMetrics();
23 | ((WindowManager) reactContext.getSystemService(Context.WINDOW_SERVICE))
24 | .getDefaultDisplay()
25 | .getRealMetrics(metrics);
26 | } else {
27 | metrics = reactContext.getResources().getDisplayMetrics();
28 | }
29 | }
30 |
31 | @Override
32 | public java.util.Map getExportedCustomBubblingEventTypeConstants() {
33 | final MapBuilder.Builder builder = MapBuilder.builder();
34 | for (String eventName : getEventNames())
35 | builder.put(eventName, bubbled(eventName));
36 | return builder.build();
37 | }
38 |
39 | String[] getEventNames() {
40 | return new String[0];
41 | }
42 |
43 | private java.util.Map bubbled(String callbackName) {
44 | return MapBuilder.of("phasedRegistrationNames", MapBuilder.of("bubbled", callbackName));
45 | }
46 |
47 | @Override
48 | public boolean emitEvent(ReactContext context, int id, String eventName, WritableMap param) {
49 | context.getJSModule(RCTEventEmitter.class).receiveEvent(id, eventName, param);
50 | return false;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/android/src/main/java/com/github/quadflask/react/navermap/EventEmmitableReactView.java:
--------------------------------------------------------------------------------
1 | package com.github.quadflask.react.navermap;
2 |
3 | import android.content.Context;
4 |
5 | import com.facebook.react.bridge.ReactContext;
6 | import com.facebook.react.bridge.WritableMap;
7 | import com.facebook.react.views.view.ReactViewGroup;
8 |
9 | abstract class EventEmmitableReactView extends ReactViewGroup {
10 | protected EventEmittable emitter;
11 |
12 | public EventEmmitableReactView(EventEmittable emitter, Context context) {
13 | super(context);
14 | this.emitter = emitter;
15 | }
16 |
17 | protected void emitEvent(String eventName, WritableMap param) {
18 | emitter.emitEvent((ReactContext) getContext(), getId(), eventName, param);
19 | }
20 | }
--------------------------------------------------------------------------------
/android/src/main/java/com/github/quadflask/react/navermap/OverlayImages.java:
--------------------------------------------------------------------------------
1 | package com.github.quadflask.react.navermap;
2 |
3 | import com.naver.maps.map.overlay.OverlayImage;
4 |
5 | import java.util.Map;
6 | import java.util.concurrent.ConcurrentHashMap;
7 |
8 | public class OverlayImages {
9 | private static Map store = new ConcurrentHashMap<>();
10 |
11 | public static void put(String uri, OverlayImage image) {
12 | store.put(uri, image);
13 | }
14 |
15 | public static OverlayImage get(String uri) {
16 | final OverlayImage overlayImage = store.get(uri);
17 | return overlayImage;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapCircleOverlay.java:
--------------------------------------------------------------------------------
1 | package com.github.quadflask.react.navermap;
2 |
3 | import android.content.Context;
4 |
5 | import com.naver.maps.geometry.LatLng;
6 | import com.naver.maps.map.overlay.CircleOverlay;
7 |
8 | public class RNNaverMapCircleOverlay extends ClickableRNNaverMapFeature {
9 | public RNNaverMapCircleOverlay(EventEmittable emitter, Context context) {
10 | super(emitter, context);
11 | feature = new CircleOverlay();
12 | }
13 |
14 | public void setCenter(LatLng center) {
15 | feature.setCenter(center);
16 | }
17 |
18 | public void setRadius(double radius) {
19 | feature.setRadius(radius);
20 | }
21 |
22 | public void setColor(int color) {
23 | feature.setColor(color);
24 | }
25 |
26 | public void setOutlineWidth(int width) {
27 | feature.setOutlineWidth(width);
28 | }
29 |
30 | public void setOutlineColor(int color) {
31 | feature.setOutlineColor(color);
32 | }
33 |
34 | public void setZIndex(int zIndex) {
35 | feature.setZIndex(zIndex);
36 | }
37 | }
--------------------------------------------------------------------------------
/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapCircleOverlayManager.java:
--------------------------------------------------------------------------------
1 | package com.github.quadflask.react.navermap;
2 |
3 | import android.content.Context;
4 | import android.graphics.Color;
5 | import android.os.Build;
6 | import android.util.DisplayMetrics;
7 | import android.view.WindowManager;
8 |
9 | import com.facebook.react.bridge.ReactApplicationContext;
10 | import com.facebook.react.bridge.ReadableMap;
11 | import com.facebook.react.uimanager.ThemedReactContext;
12 | import com.facebook.react.uimanager.ViewGroupManager;
13 | import com.facebook.react.uimanager.annotations.ReactProp;
14 |
15 | import androidx.annotation.NonNull;
16 |
17 | import static com.github.quadflask.react.navermap.ReactUtil.toNaverLatLng;
18 |
19 | public class RNNaverMapCircleOverlayManager extends EventEmittableViewGroupManager {
20 | private final DisplayMetrics metrics;
21 |
22 | public RNNaverMapCircleOverlayManager(ReactApplicationContext reactContext) {
23 | super(reactContext);
24 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
25 | metrics = new DisplayMetrics();
26 | ((WindowManager) reactContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay()
27 | .getRealMetrics(metrics);
28 | } else {
29 | metrics = reactContext.getResources().getDisplayMetrics();
30 | }
31 | }
32 |
33 | @Override
34 | String[] getEventNames() {
35 | return new String[]{
36 | "onClick"
37 | };
38 | }
39 |
40 | @NonNull
41 | @Override
42 | public String getName() {
43 | return "RNNaverMapCircleOverlay";
44 | }
45 |
46 | @NonNull
47 | @Override
48 | protected RNNaverMapCircleOverlay createViewInstance(@NonNull ThemedReactContext reactContext) {
49 | return new RNNaverMapCircleOverlay(this, reactContext);
50 | }
51 |
52 | @ReactProp(name = "coordinate")
53 | public void setCenter(RNNaverMapCircleOverlay view, ReadableMap map) {
54 | view.setCenter(toNaverLatLng(map));
55 | }
56 |
57 | @ReactProp(name = "radius", defaultDouble = 100.0)
58 | public void setRadius(RNNaverMapCircleOverlay view, double radius) {
59 | view.setRadius(radius);
60 | }
61 |
62 | @ReactProp(name = "color", defaultInt = Color.RED, customType = "Color")
63 | public void setColor(RNNaverMapCircleOverlay view, int color) {
64 | view.setColor(color);
65 | }
66 |
67 | @ReactProp(name = "outlineWidth", defaultInt = 0)
68 | public void setOutlineWidth(RNNaverMapCircleOverlay view, int outlineWidth) {
69 | view.setOutlineWidth(outlineWidth);
70 | }
71 |
72 | @ReactProp(name = "outlineColor", defaultInt = Color.BLACK, customType = "Color")
73 | public void setOutlineColor(RNNaverMapCircleOverlay view, int outlineColor) {
74 | view.setOutlineColor(outlineColor);
75 | }
76 |
77 | @ReactProp(name = "zIndex", defaultInt = 0)
78 | public void setZIndex(RNNaverMapCircleOverlay view, int zIndex) {
79 | view.setZIndex(zIndex);
80 | }
81 |
82 | }
83 |
--------------------------------------------------------------------------------
/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapFeature.java:
--------------------------------------------------------------------------------
1 | package com.github.quadflask.react.navermap;
2 |
3 | import android.content.Context;
4 |
5 | import com.naver.maps.map.overlay.Overlay;
6 |
7 | public abstract class RNNaverMapFeature extends EventEmmitableReactView {
8 | protected T feature;
9 |
10 | public RNNaverMapFeature(EventEmittable emitter, Context context) {
11 | super(emitter, context);
12 | }
13 |
14 | public void addToMap(RNNaverMapView map) {
15 | feature.setMap(map.getMap());
16 | }
17 |
18 | public void removeFromMap() {
19 | feature.setMap(null);
20 | //feature = null;
21 | }
22 |
23 | public T getFeature() {
24 | return feature;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapJavaModule.java:
--------------------------------------------------------------------------------
1 | package com.github.quadflask.react.navermap;
2 |
3 | import com.facebook.react.bridge.ReactApplicationContext;
4 | import com.facebook.react.bridge.ReactContextBaseJavaModule;
5 |
6 | public class RNNaverMapJavaModule extends ReactContextBaseJavaModule {
7 |
8 | public static final String REACT_CLASS = "RNNaverMapView";
9 |
10 | public RNNaverMapJavaModule(ReactApplicationContext context) {
11 | super(context);
12 | }
13 |
14 | @Override
15 | public String getName() {
16 | return REACT_CLASS;
17 | }
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapMarkerManager.java:
--------------------------------------------------------------------------------
1 | package com.github.quadflask.react.navermap;
2 |
3 | import android.content.Context;
4 | import android.graphics.Color;
5 | import android.os.Build;
6 | import android.util.DisplayMetrics;
7 | import android.view.View;
8 | import android.view.WindowManager;
9 |
10 | import androidx.annotation.NonNull;
11 | import androidx.annotation.Nullable;
12 |
13 | import com.facebook.react.bridge.ReactApplicationContext;
14 | import com.facebook.react.bridge.ReadableMap;
15 | import com.facebook.react.uimanager.ThemedReactContext;
16 | import com.facebook.react.uimanager.annotations.ReactProp;
17 | import com.naver.maps.map.overlay.Align;
18 |
19 | import static com.github.quadflask.react.navermap.ReactUtil.parseAlign;
20 | import static com.github.quadflask.react.navermap.ReactUtil.parseColorString;
21 | import static com.github.quadflask.react.navermap.ReactUtil.toNaverLatLng;
22 | import static com.github.quadflask.react.navermap.ReactUtil.px2dp;
23 |
24 | public class RNNaverMapMarkerManager extends EventEmittableViewGroupManager {
25 | private static final Align DEFAULT_CAPTION_ALIGN = Align.Bottom;
26 |
27 | private final DisplayMetrics metrics;
28 |
29 | public RNNaverMapMarkerManager(ReactApplicationContext reactContext) {
30 | super(reactContext);
31 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
32 | metrics = new DisplayMetrics();
33 | ((WindowManager) reactContext.getSystemService(Context.WINDOW_SERVICE))
34 | .getDefaultDisplay()
35 | .getRealMetrics(metrics);
36 | } else {
37 | metrics = reactContext.getResources().getDisplayMetrics();
38 | }
39 | }
40 |
41 | @Override
42 | String[] getEventNames() {
43 | return new String[]{
44 | "onClick"
45 | };
46 | }
47 |
48 | @NonNull
49 | @Override
50 | public String getName() {
51 | return "RNNaverMapMarker";
52 | }
53 |
54 | @NonNull
55 | @Override
56 | protected RNNaverMapMarker createViewInstance(@NonNull ThemedReactContext reactContext) {
57 | return new RNNaverMapMarker(this, reactContext);
58 | }
59 |
60 | @ReactProp(name = "coordinate")
61 | public void setCoordinate(RNNaverMapMarker view, ReadableMap map) {
62 | view.setCoordinate(toNaverLatLng(map));
63 | }
64 |
65 | @ReactProp(name = "anchor")
66 | public void setAnchor(RNNaverMapMarker view, ReadableMap map) {
67 | // should default to (0.5, 1) (bottom middle)
68 | float x = map != null && map.hasKey("x") ? (float) map.getDouble("x") : 0.5f;
69 | float y = map != null && map.hasKey("y") ? (float) map.getDouble("y") : 1.0f;
70 | view.setAnchor(x, y);
71 | }
72 |
73 | @ReactProp(name = "image")
74 | public void setImage(RNNaverMapMarker view, @Nullable String source) {
75 | view.setImage(source);
76 | }
77 |
78 | @ReactProp(name = "pinColor", defaultInt = Color.RED, customType = "Color")
79 | public void setPinColor(RNNaverMapMarker view, int pinColor) {
80 | view.setIconTintColor(pinColor);
81 | }
82 |
83 | @ReactProp(name = "rotation", defaultFloat = 0.0f)
84 | public void setMarkerRotation(RNNaverMapMarker view, float rotation) {
85 | view.setRotation(rotation);
86 | }
87 |
88 | @ReactProp(name = "flat", defaultBoolean = false)
89 | public void setFlat(RNNaverMapMarker view, boolean flat) {
90 | view.setFlat(flat);
91 | }
92 |
93 | @ReactProp(name = "width", defaultFloat = 64)
94 | public void setWidth(RNNaverMapMarker view, float width) {
95 | int widthInScreenPx = Math.round(metrics.density * width);
96 | view.setWidth(widthInScreenPx);
97 | }
98 |
99 | @ReactProp(name = "height", defaultFloat = 64)
100 | public void setHeight(RNNaverMapMarker view, float height) {
101 | int heightInScreenPx = Math.round(metrics.density * height);
102 | view.setHeight(heightInScreenPx);
103 | }
104 |
105 | @ReactProp(name = "animated", defaultBoolean = false)
106 | public void setAnimated(RNNaverMapMarker view, boolean animated) {
107 | view.setAnimated(animated);
108 | }
109 |
110 | @ReactProp(name = "easing", defaultInt = -1)
111 | public void setEasing(RNNaverMapMarker view, int easingFunction) {
112 | view.setEasing(easingFunction);
113 | }
114 |
115 | @ReactProp(name = "duration", defaultInt = 500)
116 | public void setDuration(RNNaverMapMarker view, int duration) {
117 | view.setDuration(duration);
118 | }
119 |
120 | @ReactProp(name = "alpha", defaultFloat = 1f)
121 | public void setAlpha(RNNaverMapMarker view, float alpha) {
122 | view.setAlpha(alpha);
123 | }
124 |
125 | @ReactProp(name = "zIndex", defaultInt = 0)
126 | public void setZIndex(RNNaverMapMarker view, int zIndex) {
127 | view.setZIndex(zIndex);
128 | }
129 |
130 | @ReactProp(name = "caption")
131 | public void setCaption(RNNaverMapMarker view, ReadableMap map) {
132 | if (map == null || !map.hasKey("text")) {
133 | view.removeCaption();
134 | return;
135 | }
136 | String text = map.getString("text");
137 | int textSize = map.hasKey("textSize") ? map.getInt("textSize") : 16;
138 | int color = map.hasKey("color") ? parseColorString(map.getString("color")) : Color.BLACK;
139 | int haloColor = map.hasKey("haloColor") ? parseColorString(map.getString("haloColor")) : Color.WHITE;
140 | int offset = map.hasKey("offset") ? px2dp(map.getInt("offset"), metrics) : 0;
141 | Align align = map.hasKey("align") ? parseAlign(map.getInt("align")) : DEFAULT_CAPTION_ALIGN;
142 |
143 | view.setCaption(text, textSize, color, haloColor, offset, align);
144 | }
145 |
146 | @Override
147 | public void addView(RNNaverMapMarker parent, View child, int index) {
148 | parent.setCustomView(child, index);
149 | }
150 |
151 | @Override
152 | public void removeView(RNNaverMapMarker parent, View view) {
153 | parent.removeCustomView(view);
154 | }
155 | }
156 |
--------------------------------------------------------------------------------
/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapPackage.java:
--------------------------------------------------------------------------------
1 | package com.github.quadflask.react.navermap;
2 |
3 | import com.facebook.react.ReactPackage;
4 | import com.facebook.react.bridge.NativeModule;
5 | import com.facebook.react.bridge.ReactApplicationContext;
6 | import com.facebook.react.uimanager.ViewManager;
7 |
8 | import java.util.Arrays;
9 | import java.util.List;
10 |
11 | public class RNNaverMapPackage implements ReactPackage {
12 | @Override
13 | public List createNativeModules(ReactApplicationContext reactContext) {
14 | return Arrays.asList(
15 | new RNNaverMapJavaModule(reactContext)
16 | );
17 | }
18 |
19 | @Override
20 | public List createViewManagers(ReactApplicationContext reactContext) {
21 | return Arrays.asList(
22 | new RNNaverMapViewManager(reactContext),
23 | new RNNaverMapViewTextureManager(reactContext),
24 | new RNNaverMapPolylineOverlayManager(reactContext),
25 | new RNNaverMapPathOverlayManager(reactContext),
26 | new RNNaverMapMarkerManager(reactContext),
27 | new RNNaverMapCircleOverlayManager(reactContext),
28 | new RNNaverMapPolygonOverlayManager(reactContext)
29 | );
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapPathOverlay.java:
--------------------------------------------------------------------------------
1 | package com.github.quadflask.react.navermap;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.drawable.Animatable;
6 | import android.net.Uri;
7 |
8 | import androidx.annotation.Nullable;
9 |
10 | import com.facebook.common.references.CloseableReference;
11 | import com.facebook.datasource.DataSource;
12 | import com.facebook.drawee.backends.pipeline.Fresco;
13 | import com.facebook.drawee.controller.BaseControllerListener;
14 | import com.facebook.drawee.drawable.ScalingUtils;
15 | import com.facebook.drawee.generic.GenericDraweeHierarchy;
16 | import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
17 | import com.facebook.drawee.interfaces.DraweeController;
18 | import com.facebook.drawee.view.DraweeHolder;
19 | import com.facebook.imagepipeline.image.CloseableImage;
20 | import com.facebook.imagepipeline.image.CloseableStaticBitmap;
21 | import com.facebook.imagepipeline.image.ImageInfo;
22 | import com.facebook.imagepipeline.request.ImageRequest;
23 | import com.facebook.imagepipeline.request.ImageRequestBuilder;
24 | import com.naver.maps.geometry.LatLng;
25 | import com.naver.maps.map.overlay.OverlayImage;
26 | import com.naver.maps.map.overlay.PathOverlay;
27 |
28 | import java.util.List;
29 |
30 | public class RNNaverMapPathOverlay extends ClickableRNNaverMapFeature {
31 | private final DraweeHolder imageHolder;
32 |
33 | public RNNaverMapPathOverlay(EventEmittable emitter, Context context) {
34 | super(emitter, context);
35 | feature = new PathOverlay();
36 | imageHolder = DraweeHolder.create(createDraweeHierarchy(), context);
37 | imageHolder.onAttach();
38 | }
39 |
40 | private GenericDraweeHierarchy createDraweeHierarchy() {
41 | return new GenericDraweeHierarchyBuilder(getResources())
42 | .setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
43 | .setFadeDuration(0)
44 | .build();
45 | }
46 |
47 | public void setCoords(List coords) {
48 | feature.setCoords(coords);
49 | }
50 |
51 | public void setWidth(float widthInScreenPx) {
52 | feature.setWidth(Math.round(widthInScreenPx));
53 | }
54 |
55 | public void setZIndex(int zIndex) {
56 | feature.setZIndex(zIndex);
57 | }
58 |
59 | public void setProgress(float progress) {
60 | feature.setProgress(progress);
61 | }
62 |
63 | public void setOutlineWidth(float widthInScreenPx) {
64 | feature.setOutlineWidth(Math.round(widthInScreenPx));
65 | }
66 |
67 | public void setColor(int color) {
68 | feature.setColor(color);
69 | }
70 |
71 | public void setPassedColor(int color) {
72 | feature.setPassedColor(color);
73 | }
74 |
75 | public void setOutlineColor(int color) {
76 | feature.setOutlineColor(color);
77 | }
78 |
79 | public void setPassedOutlineColor(int color) {
80 | feature.setPassedOutlineColor(color);
81 | }
82 |
83 | public void setPatternInterval(int patternInterval) {
84 | feature.setPatternInterval(patternInterval);
85 | }
86 |
87 | public void setPattern(String uri) {
88 | if (uri != null) {
89 | OverlayImage overlayImage = OverlayImages.get(uri);
90 | if (overlayImage != null) {
91 | setOverlayImage(overlayImage);
92 | } else {
93 | if (uri.startsWith("http://") || uri.startsWith("https://") || uri.startsWith("file://") || uri.startsWith("asset://")) {
94 | ImageRequest imageRequest = ImageRequestBuilder
95 | .newBuilderWithSource(Uri.parse(uri))
96 | .build();
97 |
98 | final DataSource> dataSource = Fresco.getImagePipeline()
99 | .fetchDecodedImage(imageRequest, this);
100 |
101 | DraweeController controller = Fresco.newDraweeControllerBuilder()
102 | .setImageRequest(imageRequest)
103 | .setControllerListener(new BaseControllerListener() {
104 | @Override
105 | public void onFinalImageSet(
106 | String id,
107 | @Nullable final ImageInfo imageInfo,
108 | @Nullable Animatable animatable) {
109 | CloseableReference imageReference = null;
110 | OverlayImage overlayImage = null;
111 | try {
112 | imageReference = dataSource.getResult();
113 | if (imageReference != null) {
114 | CloseableImage image = imageReference.get();
115 | if (image instanceof CloseableStaticBitmap) {
116 | CloseableStaticBitmap closeableStaticBitmap = (CloseableStaticBitmap) image;
117 | Bitmap bitmap = closeableStaticBitmap.getUnderlyingBitmap();
118 | if (bitmap != null) {
119 | bitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
120 | overlayImage = OverlayImage.fromBitmap(bitmap);
121 | OverlayImages.put(uri, overlayImage);
122 | }
123 | }
124 | }
125 | } finally {
126 | dataSource.close();
127 | if (imageReference != null) {
128 | CloseableReference.closeSafely(imageReference);
129 | }
130 | }
131 | if (overlayImage != null)
132 | setOverlayImage(overlayImage);
133 | }
134 | })
135 | .setOldController(imageHolder.getController())
136 | .build();
137 | imageHolder.setController(controller);
138 | } else {
139 | int rid = getRidFromName(uri);
140 | final OverlayImage overlayImage1 = OverlayImage.fromResource(rid);
141 | OverlayImages.put(uri, overlayImage1);
142 | setOverlayImage(overlayImage1);
143 | }
144 | }
145 | }
146 | }
147 |
148 | private void setOverlayImage(OverlayImage image) {
149 | feature.setPatternImage(image);
150 | }
151 |
152 | private int getRidFromName(String name) {
153 | return getContext().getResources().getIdentifier(name, "drawable", getContext().getPackageName());
154 | }
155 | }
156 |
--------------------------------------------------------------------------------
/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapPathOverlayManager.java:
--------------------------------------------------------------------------------
1 | package com.github.quadflask.react.navermap;
2 |
3 | import android.content.Context;
4 | import android.graphics.Color;
5 | import android.os.Build;
6 | import android.util.DisplayMetrics;
7 | import android.view.WindowManager;
8 |
9 | import com.facebook.react.bridge.ReactApplicationContext;
10 | import com.facebook.react.bridge.ReadableArray;
11 | import com.facebook.react.uimanager.ThemedReactContext;
12 | import com.facebook.react.uimanager.ViewGroupManager;
13 | import com.facebook.react.uimanager.annotations.ReactProp;
14 |
15 | import androidx.annotation.NonNull;
16 |
17 | import static com.github.quadflask.react.navermap.ReactUtil.toLatLngList;
18 |
19 | public class RNNaverMapPathOverlayManager extends EventEmittableViewGroupManager {
20 | private final DisplayMetrics metrics;
21 |
22 | public RNNaverMapPathOverlayManager(ReactApplicationContext reactContext) {
23 | super(reactContext);
24 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
25 | metrics = new DisplayMetrics();
26 | ((WindowManager) reactContext.getSystemService(Context.WINDOW_SERVICE))
27 | .getDefaultDisplay()
28 | .getRealMetrics(metrics);
29 | } else {
30 | metrics = reactContext.getResources().getDisplayMetrics();
31 | }
32 | }
33 |
34 | @Override
35 | String[] getEventNames() {
36 | return new String[]{
37 | "onClick"
38 | };
39 | }
40 |
41 | @NonNull
42 | @Override
43 | public String getName() {
44 | return "RNNaverMapPathOverlay";
45 | }
46 |
47 | @NonNull
48 | @Override
49 | protected RNNaverMapPathOverlay createViewInstance(@NonNull ThemedReactContext reactContext) {
50 | return new RNNaverMapPathOverlay(this, reactContext);
51 | }
52 |
53 | @ReactProp(name = "coordinates")
54 | public void setCoordinate(RNNaverMapPathOverlay view, ReadableArray coordinates) {
55 | view.setCoords(toLatLngList(coordinates));
56 | }
57 |
58 | @ReactProp(name = "width", defaultFloat = 1f)
59 | public void setStrokeWidth(RNNaverMapPathOverlay view, float widthInPoints) {
60 | float widthInScreenPx = metrics.density * widthInPoints;
61 | view.setWidth(widthInScreenPx);
62 | }
63 |
64 | @ReactProp(name = "zIndex", defaultInt = 0)
65 | public void setProgress(RNNaverMapPathOverlay view, int zIndex) {
66 | view.setZIndex(zIndex);
67 | }
68 |
69 | @ReactProp(name = "color", defaultInt = Color.RED, customType = "Color")
70 | public void setColor(RNNaverMapPathOverlay view, int color) {
71 | view.setColor(color);
72 | }
73 |
74 | @ReactProp(name = "outlineWidth", defaultFloat = 1f)
75 | public void setOutlineWidth(RNNaverMapPathOverlay view, float widthInPoints) {
76 | float widthInScreenPx = metrics.density * widthInPoints;
77 | view.setOutlineWidth(widthInScreenPx);
78 | }
79 |
80 | @ReactProp(name = "passedColor", defaultInt = Color.RED, customType = "Color")
81 | public void setPassedColor(RNNaverMapPathOverlay view, int color) {
82 | view.setPassedColor(color);
83 | }
84 |
85 | @ReactProp(name = "outlineColor", defaultInt = Color.RED, customType = "Color")
86 | public void setOutlineColor(RNNaverMapPathOverlay view, int color) {
87 | view.setOutlineColor(color);
88 | }
89 |
90 | @ReactProp(name = "passedOutlineColor", defaultInt = Color.RED, customType = "Color")
91 | public void setPassedOutlineColor(RNNaverMapPathOverlay view, int color) {
92 | view.setPassedOutlineColor(color);
93 | }
94 |
95 | @ReactProp(name = "pattern")
96 | public void setPatternInterval(RNNaverMapPathOverlay view, String image) {
97 | view.setPattern(image);
98 | }
99 |
100 | @ReactProp(name = "patternInterval", defaultFloat = 1f)
101 | public void setPatternInterval(RNNaverMapPathOverlay view, float widthInPoints) {
102 | int widthInScreenPx = Math.round(metrics.density * widthInPoints);
103 | view.setPatternInterval(widthInScreenPx);
104 | }
105 |
106 | @ReactProp(name = "progress", defaultFloat = 0f)
107 | public void setProgress(RNNaverMapPathOverlay view, float progress) {
108 | view.setProgress(progress);
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapPolygonOverlay.java:
--------------------------------------------------------------------------------
1 | package com.github.quadflask.react.navermap;
2 |
3 | import android.content.Context;
4 | import com.naver.maps.geometry.LatLng;
5 | import com.naver.maps.map.overlay.PolygonOverlay;
6 |
7 | import java.util.List;
8 |
9 | public class RNNaverMapPolygonOverlay extends ClickableRNNaverMapFeature {
10 | public RNNaverMapPolygonOverlay(EventEmittable emitter, Context context) {
11 | super(emitter, context);
12 | feature = new PolygonOverlay();
13 | }
14 |
15 | public void setCoords(List coords) {
16 | feature.setCoords(coords);
17 | }
18 |
19 | public void setColor(int color) {
20 | feature.setColor(color);
21 | }
22 |
23 | public void setOutlineWidth(float widthInScreenPx) {
24 | feature.setOutlineWidth(Math.round(widthInScreenPx));
25 | }
26 |
27 | public void setOutlineColor(int color) {
28 | feature.setOutlineColor(color);
29 | }
30 |
31 | public void setHoles(List> holes) {
32 | feature.setHoles(holes);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapPolygonOverlayManager.java:
--------------------------------------------------------------------------------
1 | package com.github.quadflask.react.navermap;
2 |
3 | import android.content.Context;
4 | import android.graphics.Color;
5 | import android.os.Build;
6 | import android.util.DisplayMetrics;
7 | import android.view.WindowManager;
8 | import androidx.annotation.NonNull;
9 | import com.facebook.react.bridge.ReactApplicationContext;
10 | import com.facebook.react.bridge.ReadableArray;
11 | import com.facebook.react.uimanager.ThemedReactContext;
12 | import com.facebook.react.uimanager.annotations.ReactProp;
13 | import com.naver.maps.geometry.LatLng;
14 |
15 | import java.util.ArrayList;
16 | import java.util.List;
17 |
18 | import static com.github.quadflask.react.navermap.ReactUtil.toLatLngList;
19 |
20 | public class RNNaverMapPolygonOverlayManager extends EventEmittableViewGroupManager {
21 | private final DisplayMetrics metrics;
22 |
23 | public RNNaverMapPolygonOverlayManager(ReactApplicationContext reactContext) {
24 | super(reactContext);
25 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
26 | metrics = new DisplayMetrics();
27 | ((WindowManager) reactContext.getSystemService(Context.WINDOW_SERVICE))
28 | .getDefaultDisplay()
29 | .getRealMetrics(metrics);
30 | } else {
31 | metrics = reactContext.getResources().getDisplayMetrics();
32 | }
33 | }
34 |
35 | @Override
36 | String[] getEventNames() {
37 | return new String[]{
38 | "onClick"
39 | };
40 | }
41 |
42 | @NonNull
43 | @Override
44 | public String getName() {
45 | return "RNNaverMapPolygonOverlay";
46 | }
47 |
48 | @NonNull
49 | @Override
50 | protected RNNaverMapPolygonOverlay createViewInstance(@NonNull ThemedReactContext reactContext) {
51 | return new RNNaverMapPolygonOverlay(this, reactContext);
52 | }
53 |
54 | @ReactProp(name = "coordinates")
55 | public void setCoordinate(RNNaverMapPolygonOverlay view, ReadableArray coordinates) {
56 | view.setCoords(toLatLngList(coordinates));
57 | }
58 |
59 | @ReactProp(name = "outlineWidth", defaultFloat = 1f)
60 | public void setOutlineWidth(RNNaverMapPolygonOverlay view, float widthInPoints) {
61 | float widthInScreenPx = metrics.density * widthInPoints;
62 | view.setOutlineWidth(widthInScreenPx);
63 | }
64 |
65 | @ReactProp(name = "outlineColor", defaultInt = Color.RED, customType = "Color")
66 | public void setOutlineColor(RNNaverMapPolygonOverlay view, int color) {
67 | view.setOutlineColor(color);
68 | }
69 |
70 | @ReactProp(name = "color", defaultInt = Color.RED, customType = "Color")
71 | public void setColor(RNNaverMapPolygonOverlay view, int color) {
72 | view.setColor(color);
73 | }
74 |
75 | @ReactProp(name = "holes")
76 | public void setHoles(RNNaverMapPolygonOverlay view, ReadableArray holes) {
77 | List> holesArray = new ArrayList<>(holes.size());
78 | for (int i = 0; i < holes.size(); i++) {
79 | ReadableArray hole = holes.getArray(i);
80 | if (hole.size() >= 3)
81 | holesArray.add(toLatLngList(hole));
82 | }
83 | view.setHoles(holesArray);
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapPolylineOverlay.java:
--------------------------------------------------------------------------------
1 | package com.github.quadflask.react.navermap;
2 |
3 | import android.content.Context;
4 |
5 | import com.naver.maps.geometry.LatLng;
6 | import com.naver.maps.map.overlay.PolylineOverlay;
7 |
8 | import java.util.List;
9 |
10 | public class RNNaverMapPolylineOverlay extends ClickableRNNaverMapFeature {
11 | public RNNaverMapPolylineOverlay(EventEmittable emitter, Context context) {
12 | super(emitter, context);
13 | feature = new PolylineOverlay();
14 | }
15 |
16 | public void setCoords(List coords) {
17 | feature.setCoords(coords);
18 | }
19 |
20 | public void setLineWidth(float widthInScreenPx) {
21 | feature.setWidth(Math.round(widthInScreenPx));
22 | }
23 |
24 | public void setLineColor(int color) {
25 | feature.setColor(color);
26 | }
27 |
28 | public void setCapType(PolylineOverlay.LineCap value) {
29 | feature.setCapType(value);
30 | }
31 |
32 | public void setJoinType(PolylineOverlay.LineJoin value) {
33 | feature.setJoinType(value);
34 | }
35 |
36 | public void setPattern(int[] pattern) {
37 | feature.setPattern(pattern);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapPolylineOverlayManager.java:
--------------------------------------------------------------------------------
1 | package com.github.quadflask.react.navermap;
2 |
3 | import android.content.Context;
4 | import android.graphics.Color;
5 | import android.os.Build;
6 | import android.util.DisplayMetrics;
7 | import android.view.WindowManager;
8 | import androidx.annotation.NonNull;
9 | import com.facebook.react.bridge.ReactApplicationContext;
10 | import com.facebook.react.bridge.ReadableArray;
11 | import com.facebook.react.uimanager.ThemedReactContext;
12 | import com.facebook.react.uimanager.annotations.ReactProp;
13 | import com.naver.maps.map.overlay.PolylineOverlay;
14 |
15 | import static com.github.quadflask.react.navermap.ReactUtil.toLatLngList;
16 |
17 | public class RNNaverMapPolylineOverlayManager extends EventEmittableViewGroupManager {
18 | private final DisplayMetrics metrics;
19 |
20 | public RNNaverMapPolylineOverlayManager(ReactApplicationContext reactContext) {
21 | super(reactContext);
22 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
23 | metrics = new DisplayMetrics();
24 | ((WindowManager) reactContext.getSystemService(Context.WINDOW_SERVICE))
25 | .getDefaultDisplay()
26 | .getRealMetrics(metrics);
27 | } else {
28 | metrics = reactContext.getResources().getDisplayMetrics();
29 | }
30 | }
31 |
32 | @Override
33 | String[] getEventNames() {
34 | return new String[]{
35 | "onClick"
36 | };
37 | }
38 |
39 | @NonNull
40 | @Override
41 | public String getName() {
42 | return "RNNaverMapPolylineOverlay";
43 | }
44 |
45 | @NonNull
46 | @Override
47 | protected RNNaverMapPolylineOverlay createViewInstance(@NonNull ThemedReactContext reactContext) {
48 | return new RNNaverMapPolylineOverlay(this, reactContext);
49 | }
50 |
51 | @ReactProp(name = "coordinates")
52 | public void setCoordinate(RNNaverMapPolylineOverlay view, ReadableArray coordinates) {
53 | view.setCoords(toLatLngList(coordinates));
54 | }
55 |
56 | @ReactProp(name = "strokeWidth", defaultFloat = 1f)
57 | public void setStrokeWidth(RNNaverMapPolylineOverlay view, float widthInPoints) {
58 | float widthInScreenPx = metrics.density * widthInPoints;
59 | view.setLineWidth(widthInScreenPx);
60 | }
61 |
62 | @ReactProp(name = "strokeColor", defaultInt = Color.RED, customType = "Color")
63 | public void setStrokeColor(RNNaverMapPolylineOverlay view, int color) {
64 | view.setLineColor(color);
65 | }
66 |
67 | @ReactProp(name = "capType", defaultInt = 0)
68 | public void setCapType(RNNaverMapPolylineOverlay view, int capType) {
69 | view.setCapType(PolylineOverlay.LineCap.values()[capType]);
70 | }
71 |
72 | @ReactProp(name = "joinType", defaultInt = 0)
73 | public void setJoinType(RNNaverMapPolylineOverlay view, int joinType) {
74 | view.setJoinType(PolylineOverlay.LineJoin.values()[joinType]);
75 | }
76 |
77 | @ReactProp(name = "pattern")
78 | public void setPattern(RNNaverMapPolylineOverlay view, ReadableArray pattern) {
79 | int[] patternArray = new int[pattern.size()];
80 | for (int i = 0; i < pattern.size(); i++)
81 | patternArray[i] = pattern.getInt(i);
82 | view.setPattern(patternArray);
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapViewProps.java:
--------------------------------------------------------------------------------
1 | package com.github.quadflask.react.navermap;
2 |
3 | import android.view.View;
4 |
5 | import com.naver.maps.geometry.LatLng;
6 | import com.naver.maps.geometry.LatLngBounds;
7 | import com.naver.maps.map.NaverMap;
8 |
9 | public interface RNNaverMapViewProps {
10 | String[] EVENT_NAMES = new String[]{
11 | "onInitialized",
12 | "onCameraChange",
13 | "onMapClick",
14 | "onTouch"
15 | };
16 |
17 | void onStop();
18 |
19 | void setCenter(LatLng latLng);
20 |
21 | void setCenter(LatLng latLng, Double zoom, Double tilt, Double bearing);
22 |
23 | void zoomTo(LatLngBounds latLngBounds, int paddingInPx);
24 |
25 | void setTilt(int tilt);
26 |
27 | void setBearing(int bearing);
28 |
29 | void setZoom(float zoom);
30 |
31 | void setMapPadding(int left, int top, int right, int bottom);
32 |
33 | void onInitialized();
34 |
35 | void showsMyLocationButton(boolean show);
36 |
37 | void setCompassEnabled(boolean show);
38 |
39 | void setScaleBarEnabled(boolean show);
40 |
41 | void setZoomControlEnabled(boolean show);
42 |
43 | void setLocationTrackingMode(int mode);
44 |
45 | void setMapType(NaverMap.MapType value);
46 |
47 | void setBuildingHeight(float height);
48 |
49 | void setMinZoom(float minZoomLevel);
50 |
51 | void setMaxZoom(float maxZoomLevel);
52 |
53 | void setLayerGroupEnabled(String layerGroup, boolean enable);
54 |
55 | void setNightModeEnabled(boolean enable);
56 |
57 | void setLogoMargin(int left, int top, int right, int bottom);
58 |
59 | void setLogoGravity(int gravity);
60 |
61 | void setScrollGesturesEnabled(boolean enabled);
62 |
63 | void setZoomGesturesEnabled(boolean enabled);
64 |
65 | void setTiltGesturesEnabled(boolean enabled);
66 |
67 | void setRotateGesturesEnabled(boolean enabled);
68 |
69 | void setStopGesturesEnabled(boolean enabled);
70 |
71 | void setLiteModeEnabled(boolean enabled);
72 |
73 | void moveCameraFitBound(LatLngBounds bounds, int left, int top, int right, int bottom);
74 |
75 | void addFeature(View child, int index);
76 |
77 | void removeFeatureAt(int index);
78 |
79 | int getFeatureCount();
80 |
81 | View getFeatureAt(int index);
82 | }
83 |
--------------------------------------------------------------------------------
/android/src/main/java/com/github/quadflask/react/navermap/RNNaverMapViewTextureManager.java:
--------------------------------------------------------------------------------
1 | package com.github.quadflask.react.navermap;
2 |
3 | import androidx.annotation.NonNull;
4 | import com.facebook.react.bridge.ReactApplicationContext;
5 | import com.naver.maps.map.NaverMapOptions;
6 |
7 | public class RNNaverMapViewTextureManager extends RNNaverMapViewManager {
8 | public RNNaverMapViewTextureManager(ReactApplicationContext context) {
9 | super(context);
10 | }
11 |
12 | @NonNull
13 | @Override
14 | public String getName() {
15 | return "RNNaverMapViewTexture";
16 | }
17 |
18 | @Override
19 | protected NaverMapOptions getNaverMapViewOptions() {
20 | return new NaverMapOptions()
21 | .useTextureView(true)
22 | .translucentTextureSurface(true);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/android/src/main/java/com/github/quadflask/react/navermap/ReactUtil.java:
--------------------------------------------------------------------------------
1 | package com.github.quadflask.react.navermap;
2 |
3 | import android.content.Context;
4 | import android.util.DisplayMetrics;
5 | import android.graphics.Color;
6 | import android.graphics.PointF;
7 |
8 | import androidx.core.util.Consumer;
9 |
10 | import com.facebook.react.bridge.ReactApplicationContext;
11 | import com.facebook.react.bridge.ReadableArray;
12 | import com.facebook.react.bridge.ReadableMap;
13 | import com.facebook.react.bridge.WritableArray;
14 | import com.facebook.react.bridge.WritableMap;
15 | import com.facebook.react.bridge.WritableNativeArray;
16 | import com.facebook.react.bridge.WritableNativeMap;
17 | import com.facebook.react.uimanager.ThemedReactContext;
18 | import com.naver.maps.geometry.LatLng;
19 | import com.naver.maps.map.overlay.Align;
20 |
21 | import java.util.ArrayList;
22 | import java.util.List;
23 |
24 | public class ReactUtil {
25 | public static int parseColorString(String hex) {
26 | if (hex.startsWith("#")) {
27 | hex = hex.substring(1);
28 | } else if (hex.startsWith("0x")) {
29 | hex = hex.substring(2);
30 | }
31 |
32 | if (hex.length() == 6) { // rgb
33 | int rgb = Integer.valueOf(hex, 16);
34 | return 0xff000000 | rgb;
35 | } else if (hex.length() == 10) { // argb
36 | int a = Integer.valueOf(hex.substring(0, 2), 16);
37 | int rgb = Integer.valueOf(hex.substring(2), 16);
38 | return a << 24 | rgb;
39 | }
40 | return Color.BLACK;
41 | }
42 |
43 | public static Align parseAlign(int align) {
44 | if (align < 0 || align >= Align.values().length) return Align.Bottom;
45 | return Align.values()[align];
46 | }
47 |
48 | public static LatLng toNaverLatLng(ReadableMap map) {
49 | final double latitude = map.getDouble("latitude");
50 | final double longitude = map.getDouble("longitude");
51 |
52 | return new LatLng(latitude, longitude);
53 | }
54 |
55 | public static List toLatLngList(ReadableArray array) {
56 | List coords = new ArrayList<>(array.size());
57 |
58 | for (int i = 0; i < array.size(); i++)
59 | coords.add(toNaverLatLng(array.getMap(i)));
60 |
61 | return coords;
62 | }
63 |
64 | public static WritableMap toWritableMap(LatLng latLng) {
65 | WritableMap map = new WritableNativeMap();
66 | map.putDouble("latitude", latLng.latitude);
67 | map.putDouble("longitude", latLng.longitude);
68 | return map;
69 | }
70 |
71 | public static WritableArray toWritableArray(LatLng[] latLngs) {
72 | WritableArray array = new WritableNativeArray();
73 | for (LatLng latLng : latLngs)
74 | array.pushMap(toWritableMap(latLng));
75 | return array;
76 | }
77 |
78 | public static Integer getInt(@androidx.annotation.Nullable ReadableMap option, String key, Integer defaultValue) {
79 | if (option != null && option.hasKey(key))
80 | return option.getInt(key);
81 | return defaultValue;
82 | }
83 |
84 | public static Double getDoubleOrNull(ReadableMap option, String key) {
85 | if (option.hasKey(key)) return option.getDouble(key);
86 | return null;
87 | }
88 |
89 | public static void getNumber(ReadableMap option, String key, Consumer consumer) {
90 | if (option.hasKey(key))
91 | consumer.accept(option.getDouble(key));
92 | }
93 |
94 | public static void getFloat(ReadableMap option, String key, Consumer consumer) {
95 | if (option.hasKey(key))
96 | consumer.accept((float) option.getDouble(key));
97 | }
98 |
99 | public static void getInt(ReadableMap option, String key, Consumer consumer) {
100 | if (option.hasKey(key))
101 | consumer.accept(option.getInt(key));
102 | }
103 |
104 | public static void getString(ReadableMap option, String key, Consumer consumer) {
105 | if (option.hasKey(key))
106 | consumer.accept(option.getString(key));
107 | }
108 |
109 | public static void getBoolean(ReadableMap option, String key, Consumer consumer) {
110 | if (option.hasKey(key))
111 | consumer.accept(option.getBoolean(key));
112 | }
113 |
114 | public static void getHexColor(ReadableMap option, String key, Consumer consumer) {
115 | getString(option, key, s -> consumer.accept(parseColorString(s)));
116 | }
117 |
118 | public static void getLatLng(ReadableMap option, String key, Consumer consumer) {
119 | if (option.hasKey(key) && option.hasKey("latitude") && option.hasKey("longitude"))
120 | consumer.accept(new LatLng(option.getDouble("latitude"), option.getDouble("longitude")));
121 | }
122 |
123 | public static void getLatLngList(ReadableMap option, String key, Consumer> consumer) {
124 | if (option.hasKey(key)) {
125 | consumer.accept(toLatLngList(option.getArray(key)));
126 | }
127 | }
128 |
129 | public static void getAnchor(ReadableMap option, Consumer consumer) {
130 | if (option.hasKey("anchor")) {
131 | PointF anchor = new PointF(0.5f, 1); // default anchor to bottom
132 | final ReadableArray anchorArray = option.getArray("anchor");
133 | anchor.x = (float) anchorArray.getDouble(0);
134 | anchor.y = (float) anchorArray.getDouble(1);
135 | consumer.accept(anchor);
136 | }
137 | }
138 |
139 | public static LatLng interpolate(float fraction, LatLng a, LatLng b) {
140 | double lat = (b.latitude - a.latitude) * fraction + a.latitude;
141 | double lng = (b.longitude - a.longitude) * fraction + a.longitude;
142 | return new LatLng(lat, lng);
143 | }
144 |
145 | private static boolean contextHasBug(Context context) {
146 | return context == null ||
147 | context.getResources() == null ||
148 | context.getResources().getConfiguration() == null;
149 | }
150 |
151 | public static Context getNonBuggyContext(ThemedReactContext reactContext, ReactApplicationContext appContext) {
152 | Context superContext = reactContext;
153 | if (!contextHasBug(appContext.getCurrentActivity())) {
154 | superContext = appContext.getCurrentActivity();
155 | } else if (contextHasBug(superContext)) {
156 | // we have the bug! let's try to find a better context to use
157 | if (!contextHasBug(reactContext.getCurrentActivity())) {
158 | superContext = reactContext.getCurrentActivity();
159 | } else if (!contextHasBug(reactContext.getApplicationContext())) {
160 | superContext = reactContext.getApplicationContext();
161 | } else {
162 | // ¯\_(ツ)_/¯
163 | }
164 | }
165 | return superContext;
166 | }
167 |
168 | public static int px2dp(int px, DisplayMetrics metrics){
169 | float dp = px * ((float) metrics.density);
170 |
171 | return (int) dp;
172 | }
173 | }
174 |
--------------------------------------------------------------------------------
/example/.buckconfig:
--------------------------------------------------------------------------------
1 |
2 | [android]
3 | target = Google Inc.:Google APIs:23
4 |
5 | [maven_repositories]
6 | central = https://repo1.maven.org/maven2
7 |
--------------------------------------------------------------------------------
/example/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | extends: '@react-native-community',
4 | };
5 |
--------------------------------------------------------------------------------
/example/.flowconfig:
--------------------------------------------------------------------------------
1 | [ignore]
2 | ; We fork some components by platform
3 | .*/*[.]android.js
4 |
5 | ; Ignore "BUCK" generated dirs
6 | /\.buckd/
7 |
8 | ; Ignore polyfills
9 | node_modules/react-native/Libraries/polyfills/.*
10 |
11 | ; These should not be required directly
12 | ; require from fbjs/lib instead: require('fbjs/lib/warning')
13 | node_modules/warning/.*
14 |
15 | ; Flow doesn't support platforms
16 | .*/Libraries/Utilities/LoadingView.js
17 |
18 | [untyped]
19 | .*/node_modules/@react-native-community/cli/.*/.*
20 |
21 | [include]
22 |
23 | [libs]
24 | node_modules/react-native/Libraries/react-native/react-native-interface.js
25 | node_modules/react-native/flow/
26 |
27 | [options]
28 | emoji=true
29 |
30 | esproposal.optional_chaining=enable
31 | esproposal.nullish_coalescing=enable
32 |
33 | module.file_ext=.js
34 | module.file_ext=.json
35 | module.file_ext=.ios.js
36 |
37 | munge_underscores=true
38 |
39 | module.name_mapper='^react-native$' -> '/node_modules/react-native/Libraries/react-native/react-native-implementation'
40 | module.name_mapper='^react-native/\(.*\)$' -> '/node_modules/react-native/\1'
41 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '/node_modules/react-native/Libraries/Image/RelativeImageStub'
42 |
43 | suppress_type=$FlowIssue
44 | suppress_type=$FlowFixMe
45 | suppress_type=$FlowFixMeProps
46 | suppress_type=$FlowFixMeState
47 |
48 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
49 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
50 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
51 |
52 | [lints]
53 | sketchy-null-number=warn
54 | sketchy-null-mixed=warn
55 | sketchy-number=warn
56 | untyped-type-import=warn
57 | nonstrict-import=warn
58 | deprecated-type=warn
59 | unsafe-getters-setters=warn
60 | inexact-spread=warn
61 | unnecessary-invariant=warn
62 | signature-verification-failure=warn
63 | deprecated-utility=error
64 |
65 | [strict]
66 | deprecated-type
67 | nonstrict-import
68 | sketchy-null
69 | unclear-type
70 | unsafe-getters-setters
71 | untyped-import
72 | untyped-type-import
73 |
74 | [version]
75 | ^0.105.0
76 |
--------------------------------------------------------------------------------
/example/.gitattributes:
--------------------------------------------------------------------------------
1 | *.pbxproj -text
2 |
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX
2 | #
3 | .DS_Store
4 |
5 | # Xcode
6 | #
7 | build/
8 | *.pbxuser
9 | !default.pbxuser
10 | *.mode1v3
11 | !default.mode1v3
12 | *.mode2v3
13 | !default.mode2v3
14 | *.perspectivev3
15 | !default.perspectivev3
16 | xcuserdata
17 | *.xccheckout
18 | *.moved-aside
19 | DerivedData
20 | *.hmap
21 | *.ipa
22 | *.xcuserstate
23 | project.xcworkspace
24 |
25 | # Android/IntelliJ
26 | #
27 | build/
28 | .idea
29 | .gradle
30 | local.properties
31 | *.iml
32 |
33 | # node.js
34 | #
35 | node_modules/
36 | npm-debug.log
37 | yarn-error.log
38 |
39 | # BUCK
40 | buck-out/
41 | \.buckd/
42 | *.keystore
43 | !debug.keystore
44 |
45 | # fastlane
46 | #
47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
48 | # screenshots whenever they are needed.
49 | # For more information about the recommended setup visit:
50 | # https://docs.fastlane.tools/best-practices/source-control/
51 |
52 | */fastlane/report.xml
53 | */fastlane/Preview.html
54 | */fastlane/screenshots
55 |
56 | # Bundle artifact
57 | *.jsbundle
58 |
59 | # CocoaPods
60 | /ios/Pods/
61 |
--------------------------------------------------------------------------------
/example/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | bracketSpacing: false,
3 | jsxBracketSameLine: true,
4 | singleQuote: true,
5 | trailingComma: 'all',
6 | };
7 |
--------------------------------------------------------------------------------
/example/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/example/App.js:
--------------------------------------------------------------------------------
1 | import 'react-native-gesture-handler';
2 | import React, {useEffect, useRef, useState} from 'react';
3 | import NaverMapView, {Align, Circle, Marker, Path, Polygon, Polyline} from "./map";
4 | import {Image, ImageBackground, PermissionsAndroid, Platform, ScrollView, Text, TouchableOpacity, View} from "react-native";
5 | import {NavigationContainer} from '@react-navigation/native';
6 | import {createBottomTabNavigator} from "@react-navigation/bottom-tabs";
7 | import {createStackNavigator} from "@react-navigation/stack";
8 | import { LayerGroup } from './map/index';
9 |
10 | const P0 = {latitude: 37.564362, longitude: 126.977011};
11 | const P1 = {latitude: 37.565051, longitude: 126.978567};
12 | const P2 = {latitude: 37.565383, longitude: 126.976292};
13 | const P4 = {latitude: 37.564834, longitude: 126.977218};
14 | const P5 = {latitude: 37.562834, longitude: 126.976218};
15 |
16 | const Tab = createBottomTabNavigator();
17 | const Stack = createStackNavigator();
18 |
19 | const App = () => {
20 | return
21 |
22 |
23 |
24 |
25 |
26 | }
27 |
28 | const HomeScreen = () =>
29 |
30 |
31 |
32 |
33 |
34 | const TextScreen = () => {
35 | return text
36 | }
37 |
38 | const MapViewScreen = ({navigation}) => {
39 | const mapView = useRef(null);
40 |
41 | useEffect(() => {
42 | requestLocationPermission();
43 | }, []);
44 |
45 | const [enableLayerGroup, setEnableLayerGroup] = useState(true);
46 |
47 | return <>
48 | console.warn('onTouch', JSON.stringify(e.nativeEvent))}
53 | onCameraChange={e => console.warn('onCameraChange', JSON.stringify(e))}
54 | onMapClick={e => console.warn('onMapClick', JSON.stringify(e))}
55 | useTextureView>
56 | {
58 | console.warn('onClick! p0')
59 | mapView.current.setLayerGroupEnabled(LayerGroup.LAYER_GROUP_BICYCLE, enableLayerGroup);
60 | mapView.current.setLayerGroupEnabled(LayerGroup.LAYER_GROUP_TRANSIT, enableLayerGroup);
61 | setEnableLayerGroup(!enableLayerGroup)
62 | }}
63 | caption={{ text: "test caption", align: Align.Left }}
64 | />
65 | console.warn('onClick! p1')}/>
66 | console.warn('onClick! p2')}/>
67 | console.warn('onClick! p4')} image={require("./marker.png")} width={48} height={48}/>
68 | console.warn('onClick! path')} width={10}/>
69 | console.warn('onClick! polyline')}/>
70 | console.warn('onClick! circle')}/>
71 | console.warn('onClick! polygon')}/>
72 | console.warn('onClick! p0')} width={96} height={96}>
73 |
74 |
75 |
80 | Image
81 |
82 |
83 | image background
84 |
85 |
86 |
87 |
88 | navigation.navigate('stack')}>
89 |
90 | open stack
91 |
92 |
93 | Icon made by Pixel perfect from www.flaticon.com
94 | >
95 | };
96 |
97 | const MapViewScreen2 = ({navigation}) => {
98 | return
99 |
100 |
101 | goBack
102 |
103 |
104 |
105 | scrollGesturesEnabled: default
106 |
110 |
111 |
112 | {Array.from({length: 10}, (_, i) => i).map(i => )}
113 | scrollGesturesEnabled
114 |
119 |
120 |
121 | {Array.from({length: 10}, (_, i) => i).map(i => )}
122 | scrollGesturesEnabled: false
123 |
128 |
129 |
130 | {Array.from({length: 10}, (_, i) => i).map(i => )}
131 |
132 |
133 | }
134 |
135 | async function requestLocationPermission() {
136 | if (Platform.OS !== 'android') return;
137 | try {
138 | const granted = await PermissionsAndroid.request(
139 | PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
140 | {
141 | title: 'Location Permission',
142 | message: 'show my location need Location permission',
143 | buttonNeutral: 'Ask Me Later',
144 | buttonNegative: 'Cancel',
145 | buttonPositive: 'OK',
146 | },
147 | );
148 | if (granted === PermissionsAndroid.RESULTS.GRANTED) {
149 | console.log('You can use the location');
150 | } else {
151 | console.log('Location permission denied');
152 | }
153 | } catch (err) {
154 | console.warn(err);
155 | }
156 | }
157 |
158 |
159 | export default App;
160 |
--------------------------------------------------------------------------------
/example/__tests__/App-test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @format
3 | */
4 |
5 | import 'react-native';
6 | import React from 'react';
7 | import App from '../App';
8 |
9 | // Note: test renderer must be required after react-native.
10 | import renderer from 'react-test-renderer';
11 |
12 | it('renders correctly', () => {
13 | renderer.create();
14 | });
15 |
--------------------------------------------------------------------------------
/example/android/app/BUCK:
--------------------------------------------------------------------------------
1 | # To learn about Buck see [Docs](https://buckbuild.com/).
2 | # To run your application with Buck:
3 | # - install Buck
4 | # - `npm start` - to start the packager
5 | # - `cd android`
6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8 | # - `buck install -r android/app` - compile, install and run application
9 | #
10 |
11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12 |
13 | lib_deps = []
14 |
15 | create_aar_targets(glob(["libs/*.aar"]))
16 |
17 | create_jar_targets(glob(["libs/*.jar"]))
18 |
19 | android_library(
20 | name = "all-libs",
21 | exported_deps = lib_deps,
22 | )
23 |
24 | android_library(
25 | name = "app-code",
26 | srcs = glob([
27 | "src/main/java/**/*.java",
28 | ]),
29 | deps = [
30 | ":all-libs",
31 | ":build_config",
32 | ":res",
33 | ],
34 | )
35 |
36 | android_build_config(
37 | name = "build_config",
38 | package = "com.example",
39 | )
40 |
41 | android_resource(
42 | name = "res",
43 | package = "com.example",
44 | res = "src/main/res",
45 | )
46 |
47 | android_binary(
48 | name = "app",
49 | keystore = "//android/keystores:debug",
50 | manifest = "src/main/AndroidManifest.xml",
51 | package_type = "debug",
52 | deps = [
53 | ":app-code",
54 | ],
55 | )
56 |
--------------------------------------------------------------------------------
/example/android/app/build_defs.bzl:
--------------------------------------------------------------------------------
1 | """Helper definitions to glob .aar and .jar targets"""
2 |
3 | def create_aar_targets(aarfiles):
4 | for aarfile in aarfiles:
5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
6 | lib_deps.append(":" + name)
7 | android_prebuilt_aar(
8 | name = name,
9 | aar = aarfile,
10 | )
11 |
12 | def create_jar_targets(jarfiles):
13 | for jarfile in jarfiles:
14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
15 | lib_deps.append(":" + name)
16 | prebuilt_jar(
17 | name = name,
18 | binary_jar = jarfile,
19 | )
20 |
--------------------------------------------------------------------------------
/example/android/app/debug.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZeroCho/react-native-naver-map/b2134b45f0db93374863bbb1ead8efc477691c6b/example/android/app/debug.keystore
--------------------------------------------------------------------------------
/example/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
15 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/example/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import com.facebook.react.ReactActivity;
4 |
5 | public class MainActivity extends ReactActivity {
6 |
7 | /**
8 | * Returns the name of the main component registered from JavaScript. This is used to schedule
9 | * rendering of the component.
10 | */
11 | @Override
12 | protected String getMainComponentName() {
13 | return "example";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/example/MainApplication.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import android.app.Application;
4 | import android.content.Context;
5 | import com.facebook.react.PackageList;
6 | import com.facebook.react.ReactApplication;
7 | import com.facebook.react.ReactNativeHost;
8 | import com.facebook.react.ReactPackage;
9 | import com.facebook.soloader.SoLoader;
10 | import java.lang.reflect.InvocationTargetException;
11 | import java.util.List;
12 |
13 | public class MainApplication extends Application implements ReactApplication {
14 |
15 | private final ReactNativeHost mReactNativeHost =
16 | new ReactNativeHost(this) {
17 | @Override
18 | public boolean getUseDeveloperSupport() {
19 | return BuildConfig.DEBUG;
20 | }
21 |
22 | @Override
23 | protected List getPackages() {
24 | @SuppressWarnings("UnnecessaryLocalVariable")
25 | List packages = new PackageList(this).getPackages();
26 | // Packages that cannot be autolinked yet can be added manually here, for example:
27 | // packages.add(new MyReactNativePackage());
28 | packages.add(new com.github.quadflask.react.navermap.RNNaverMapPackage());
29 | return packages;
30 | }
31 |
32 | @Override
33 | protected String getJSMainModuleName() {
34 | return "index";
35 | }
36 | };
37 |
38 | @Override
39 | public ReactNativeHost getReactNativeHost() {
40 | return mReactNativeHost;
41 | }
42 |
43 | @Override
44 | public void onCreate() {
45 | super.onCreate();
46 | SoLoader.init(this, /* native exopackage */ false);
47 | initializeFlipper(this); // Remove this line if you don't want Flipper enabled
48 | }
49 |
50 | /**
51 | * Loads Flipper in React Native templates.
52 | *
53 | * @param context
54 | */
55 | private static void initializeFlipper(Context context) {
56 | if (BuildConfig.DEBUG) {
57 | try {
58 | /*
59 | We use reflection here to pick up the class that initializes Flipper,
60 | since Flipper library is not available in release mode
61 | */
62 | Class> aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper");
63 | aClass.getMethod("initializeFlipper", Context.class).invoke(null, context);
64 | } catch (ClassNotFoundException e) {
65 | e.printStackTrace();
66 | } catch (NoSuchMethodException e) {
67 | e.printStackTrace();
68 | } catch (IllegalAccessException e) {
69 | e.printStackTrace();
70 | } catch (InvocationTargetException e) {
71 | e.printStackTrace();
72 | }
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZeroCho/react-native-naver-map/b2134b45f0db93374863bbb1ead8efc477691c6b/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZeroCho/react-native-naver-map/b2134b45f0db93374863bbb1ead8efc477691c6b/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZeroCho/react-native-naver-map/b2134b45f0db93374863bbb1ead8efc477691c6b/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZeroCho/react-native-naver-map/b2134b45f0db93374863bbb1ead8efc477691c6b/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZeroCho/react-native-naver-map/b2134b45f0db93374863bbb1ead8efc477691c6b/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZeroCho/react-native-naver-map/b2134b45f0db93374863bbb1ead8efc477691c6b/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZeroCho/react-native-naver-map/b2134b45f0db93374863bbb1ead8efc477691c6b/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZeroCho/react-native-naver-map/b2134b45f0db93374863bbb1ead8efc477691c6b/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZeroCho/react-native-naver-map/b2134b45f0db93374863bbb1ead8efc477691c6b/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZeroCho/react-native-naver-map/b2134b45f0db93374863bbb1ead8efc477691c6b/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | example
3 |
4 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext {
5 | buildToolsVersion = "28.0.3"
6 | minSdkVersion = 16
7 | compileSdkVersion = 28
8 | targetSdkVersion = 28
9 | }
10 | repositories {
11 | google()
12 | jcenter()
13 | }
14 | dependencies {
15 | classpath("com.android.tools.build:gradle:3.5.2")
16 |
17 | // NOTE: Do not place your application dependencies here; they belong
18 | // in the individual module build.gradle files
19 | }
20 | }
21 |
22 | allprojects {
23 | repositories {
24 | mavenLocal()
25 | maven {
26 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
27 | url("$rootDir/../node_modules/react-native/android")
28 | }
29 | maven {
30 | // Android JSC is installed from npm
31 | url("$rootDir/../node_modules/jsc-android/dist")
32 | }
33 |
34 | google()
35 | jcenter()
36 |
37 | // 네이버 지도 저장소
38 | maven {
39 | url 'https://naver.jfrog.io/artifactory/maven/'
40 | }
41 |
42 | maven { url 'https://jitpack.io' }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | android.useAndroidX=true
21 | android.enableJetifier=true
22 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZeroCho/react-native-naver-map/b2134b45f0db93374863bbb1ead8efc477691c6b/example/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/example/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 | # Determine the Java command to use to start the JVM.
86 | if [ -n "$JAVA_HOME" ] ; then
87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
88 | # IBM's JDK on AIX uses strange locations for the executables
89 | JAVACMD="$JAVA_HOME/jre/sh/java"
90 | else
91 | JAVACMD="$JAVA_HOME/bin/java"
92 | fi
93 | if [ ! -x "$JAVACMD" ] ; then
94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
95 |
96 | Please set the JAVA_HOME variable in your environment to match the
97 | location of your Java installation."
98 | fi
99 | else
100 | JAVACMD="java"
101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
102 |
103 | Please set the JAVA_HOME variable in your environment to match the
104 | location of your Java installation."
105 | fi
106 |
107 | # Increase the maximum file descriptors if we can.
108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
109 | MAX_FD_LIMIT=`ulimit -H -n`
110 | if [ $? -eq 0 ] ; then
111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
112 | MAX_FD="$MAX_FD_LIMIT"
113 | fi
114 | ulimit -n $MAX_FD
115 | if [ $? -ne 0 ] ; then
116 | warn "Could not set maximum file descriptor limit: $MAX_FD"
117 | fi
118 | else
119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
120 | fi
121 | fi
122 |
123 | # For Darwin, add options to specify how the application appears in the dock
124 | if $darwin; then
125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
126 | fi
127 |
128 | # For Cygwin, switch paths to Windows format before running java
129 | if $cygwin ; then
130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
132 | JAVACMD=`cygpath --unix "$JAVACMD"`
133 |
134 | # We build the pattern for arguments to be converted via cygpath
135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
136 | SEP=""
137 | for dir in $ROOTDIRSRAW ; do
138 | ROOTDIRS="$ROOTDIRS$SEP$dir"
139 | SEP="|"
140 | done
141 | OURCYGPATTERN="(^($ROOTDIRS))"
142 | # Add a user-defined pattern to the cygpath arguments
143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
145 | fi
146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
147 | i=0
148 | for arg in "$@" ; do
149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
151 |
152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
154 | else
155 | eval `echo args$i`="\"$arg\""
156 | fi
157 | i=$((i+1))
158 | done
159 | case $i in
160 | (0) set -- ;;
161 | (1) set -- "$args0" ;;
162 | (2) set -- "$args0" "$args1" ;;
163 | (3) set -- "$args0" "$args1" "$args2" ;;
164 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
170 | esac
171 | fi
172 |
173 | # Escape application args
174 | save () {
175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
176 | echo " "
177 | }
178 | APP_ARGS=$(save "$@")
179 |
180 | # Collect all arguments for the java command, following the shell quoting and substitution rules
181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
182 |
183 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
184 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
185 | cd "$(dirname "$0")"
186 | fi
187 |
188 | exec "$JAVACMD" "$@"
189 |
--------------------------------------------------------------------------------
/example/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem http://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
34 |
35 | @rem Find java.exe
36 | if defined JAVA_HOME goto findJavaFromJavaHome
37 |
38 | set JAVA_EXE=java.exe
39 | %JAVA_EXE% -version >NUL 2>&1
40 | if "%ERRORLEVEL%" == "0" goto init
41 |
42 | echo.
43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
44 | echo.
45 | echo Please set the JAVA_HOME variable in your environment to match the
46 | echo location of your Java installation.
47 |
48 | goto fail
49 |
50 | :findJavaFromJavaHome
51 | set JAVA_HOME=%JAVA_HOME:"=%
52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
53 |
54 | if exist "%JAVA_EXE%" goto init
55 |
56 | echo.
57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
58 | echo.
59 | echo Please set the JAVA_HOME variable in your environment to match the
60 | echo location of your Java installation.
61 |
62 | goto fail
63 |
64 | :init
65 | @rem Get command-line arguments, handling Windows variants
66 |
67 | if not "%OS%" == "Windows_NT" goto win9xME_args
68 |
69 | :win9xME_args
70 | @rem Slurp the command line arguments.
71 | set CMD_LINE_ARGS=
72 | set _SKIP=2
73 |
74 | :win9xME_args_slurp
75 | if "x%~1" == "x" goto execute
76 |
77 | set CMD_LINE_ARGS=%*
78 |
79 | :execute
80 | @rem Setup the command line
81 |
82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
83 |
84 | @rem Execute Gradle
85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
86 |
87 | :end
88 | @rem End local scope for the variables with windows NT shell
89 | if "%ERRORLEVEL%"=="0" goto mainEnd
90 |
91 | :fail
92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
93 | rem the _cmd.exe /c_ return code!
94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
95 | exit /b 1
96 |
97 | :mainEnd
98 | if "%OS%"=="Windows_NT" endlocal
99 |
100 | :omega
101 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'example'
2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
3 | include ':app', ':reactNativeNMap'
4 | project(':reactNativeNMap').projectDir = file("../../android")
5 |
--------------------------------------------------------------------------------
/example/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "example",
3 | "displayName": "example"
4 | }
--------------------------------------------------------------------------------
/example/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: ['module:metro-react-native-babel-preset'],
3 | };
4 |
--------------------------------------------------------------------------------
/example/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @format
3 | */
4 |
5 | import {AppRegistry} from 'react-native';
6 | import App from './App';
7 | import {name as appName} from './app.json';
8 |
9 | AppRegistry.registerComponent(appName, () => App);
10 |
--------------------------------------------------------------------------------
/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | platform :ios, '9.0'
2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
3 |
4 | target 'example' do
5 | # Pods for example
6 | pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
7 | pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
8 | pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
9 | pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
10 | pod 'React', :path => '../node_modules/react-native/'
11 | pod 'React-Core', :path => '../node_modules/react-native/'
12 | pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
13 | pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
14 | pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
15 | pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
16 | pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
17 | pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
18 | pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
19 | pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
20 | pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
21 | pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
22 | pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
23 | pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
24 |
25 | pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
26 | pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
27 | pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
28 | pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
29 | pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
30 | pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
31 | pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
32 |
33 | pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
34 | pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
35 | pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
36 | pod 'NMapsMap'
37 |
38 | target 'exampleTests' do
39 | inherit! :search_paths
40 | # Pods for testing
41 | end
42 |
43 | use_native_modules!
44 | end
45 |
46 | target 'example-tvOS' do
47 | # Pods for example-tvOS
48 |
49 | target 'example-tvOSTests' do
50 | inherit! :search_paths
51 | # Pods for testing
52 | end
53 |
54 | end
55 |
--------------------------------------------------------------------------------
/example/ios/example-tvOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | NSAppTransportSecurity
26 |
27 | NSExceptionDomains
28 |
29 | localhost
30 |
31 | NSExceptionAllowsInsecureHTTPLoads
32 |
33 |
34 |
35 |
36 | NSLocationWhenInUseUsageDescription
37 |
38 | UILaunchStoryboardName
39 | LaunchScreen
40 | UIRequiredDeviceCapabilities
41 |
42 | armv7
43 |
44 | UISupportedInterfaceOrientations
45 |
46 | UIInterfaceOrientationPortrait
47 | UIInterfaceOrientationLandscapeLeft
48 | UIInterfaceOrientationLandscapeRight
49 |
50 | UIViewControllerBasedStatusBarAppearance
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/example/ios/example-tvOSTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/example/ios/example.xcodeproj/xcshareddata/xcschemes/example-tvOS.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
43 |
49 |
50 |
51 |
52 |
53 |
58 |
59 |
61 |
67 |
68 |
69 |
70 |
71 |
77 |
78 |
79 |
80 |
81 |
82 |
92 |
94 |
100 |
101 |
102 |
103 |
104 |
105 |
111 |
113 |
119 |
120 |
121 |
122 |
124 |
125 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
43 |
49 |
50 |
51 |
52 |
53 |
58 |
59 |
65 |
66 |
67 |
68 |
70 |
76 |
77 |
78 |
79 |
80 |
91 |
93 |
99 |
100 |
101 |
102 |
108 |
110 |
116 |
117 |
118 |
119 |
121 |
122 |
125 |
126 |
127 |
--------------------------------------------------------------------------------
/example/ios/example.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/ios/example/AppDelegate.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Facebook, Inc. and its affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | #import
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (nonatomic, strong) UIWindow *window;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/example/ios/example/AppDelegate.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Facebook, Inc. and its affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | #import "AppDelegate.h"
9 |
10 | #import
11 | #import
12 | #import
13 |
14 | @implementation AppDelegate
15 |
16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
17 | {
18 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
19 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
20 | moduleName:@"example"
21 | initialProperties:nil];
22 |
23 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
24 |
25 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
26 | UIViewController *rootViewController = [UIViewController new];
27 | rootViewController.view = rootView;
28 | self.window.rootViewController = rootViewController;
29 | [self.window makeKeyAndVisible];
30 | return YES;
31 | }
32 |
33 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
34 | {
35 | #if DEBUG
36 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
37 | #else
38 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
39 | #endif
40 | }
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/example/ios/example/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
21 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | },
43 | {
44 | "idiom" : "ios-marketing",
45 | "size" : "1024x1024",
46 | "scale" : "1x"
47 | }
48 | ],
49 | "info" : {
50 | "version" : 1,
51 | "author" : "xcode"
52 | }
53 | }
--------------------------------------------------------------------------------
/example/ios/example/Images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/example/ios/example/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | example
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | LSRequiresIPhoneOS
26 |
27 | NMFClientId
28 | 7xyduy51sa
29 | NSAppTransportSecurity
30 |
31 | NSAllowsArbitraryLoads
32 |
33 | NSExceptionDomains
34 |
35 | localhost
36 |
37 | NSExceptionAllowsInsecureHTTPLoads
38 |
39 |
40 |
41 |
42 | NSLocationWhenInUseUsageDescription
43 |
44 | UILaunchStoryboardName
45 | LaunchScreen
46 | UIRequiredDeviceCapabilities
47 |
48 | armv7
49 |
50 | UISupportedInterfaceOrientations
51 |
52 | UIInterfaceOrientationPortrait
53 | UIInterfaceOrientationLandscapeLeft
54 | UIInterfaceOrientationLandscapeRight
55 |
56 | UIViewControllerBasedStatusBarAppearance
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/example/ios/example/main.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Facebook, Inc. and its affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | #import
9 |
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/example/ios/exampleTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/example/ios/exampleTests/exampleTests.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Facebook, Inc. and its affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | #import
9 | #import
10 |
11 | #import
12 | #import
13 |
14 | #define TIMEOUT_SECONDS 600
15 | #define TEXT_TO_LOOK_FOR @"Welcome to React"
16 |
17 | @interface exampleTests : XCTestCase
18 |
19 | @end
20 |
21 | @implementation exampleTests
22 |
23 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
24 | {
25 | if (test(view)) {
26 | return YES;
27 | }
28 | for (UIView *subview in [view subviews]) {
29 | if ([self findSubviewInView:subview matching:test]) {
30 | return YES;
31 | }
32 | }
33 | return NO;
34 | }
35 |
36 | - (void)testRendersWelcomeScreen
37 | {
38 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
39 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
40 | BOOL foundElement = NO;
41 |
42 | __block NSString *redboxError = nil;
43 | #ifdef DEBUG
44 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
45 | if (level >= RCTLogLevelError) {
46 | redboxError = message;
47 | }
48 | });
49 | #endif
50 |
51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
54 |
55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
57 | return YES;
58 | }
59 | return NO;
60 | }];
61 | }
62 |
63 | #ifdef DEBUG
64 | RCTSetLogFunction(RCTDefaultLogFunction);
65 | #endif
66 |
67 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
68 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
69 | }
70 |
71 |
72 | @end
73 |
--------------------------------------------------------------------------------
/example/map/index.d.ts:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { ImageSourcePropType, StyleProp, ViewStyle } from 'react-native';
3 | declare const RNNaverMapView: any;
4 | export interface Coord {
5 | latitude: number;
6 | longitude: number;
7 | }
8 | export interface Region extends Coord {
9 | latitudeDelta: number;
10 | longitudeDelta: number;
11 | }
12 | export declare enum TrackingMode {
13 | None = 0,
14 | NoFollow = 1,
15 | Follow = 2,
16 | Face = 3
17 | }
18 | export declare enum MapType {
19 | Basic = 0,
20 | Navi = 1,
21 | Satellite = 2,
22 | Hybrid = 3,
23 | Terrain = 4
24 | }
25 | export declare enum LayerGroup {
26 | LAYER_GROUP_BUILDING = "building",
27 | LAYER_GROUP_TRANSIT = "transit",
28 | LAYER_GROUP_BICYCLE = "bike",
29 | LAYER_GROUP_TRAFFIC = "ctt",
30 | LAYER_GROUP_CADASTRAL = "landparcel",
31 | LAYER_GROUP_MOUNTAIN = "mountain"
32 | }
33 | export declare enum Gravity {
34 | NO_GRAVITY = 0,
35 | AXIS_SPECIFIED = 1,
36 | AXIS_PULL_BEFORE = 2,
37 | AXIS_PULL_AFTER = 4,
38 | AXIS_X_SHIFT = 0,
39 | AXIS_Y_SHIFT = 4,
40 | TOP = 48,
41 | BOTTOM = 80,
42 | LEFT = 3,
43 | RIGHT = 5,
44 | CENTER_VERTICAL = 16,
45 | CENTER_HORIZONTAL = 1
46 | }
47 | export declare enum Align {
48 | Center = 0,
49 | Left = 1,
50 | Right = 2,
51 | Top = 3,
52 | Bottom = 4,
53 | TopLeft = 5,
54 | TopRight = 6,
55 | BottomRight = 7,
56 | BottomLeft = 8
57 | }
58 | export interface Rect {
59 | left?: number;
60 | top?: number;
61 | right?: number;
62 | bottom?: number;
63 | }
64 | export interface NaverMapViewProps {
65 | style?: StyleProp;
66 | center?: Coord & {
67 | zoom?: number;
68 | tilt?: number;
69 | bearing?: number;
70 | };
71 | tilt?: number;
72 | bearing?: number;
73 | mapPadding?: Rect;
74 | logoMargin?: Rect;
75 | logoGravity?: Gravity;
76 | onInitialized?: Function;
77 | onCameraChange?: (event: {
78 | latitude: number;
79 | longitude: number;
80 | zoom: number;
81 | contentsRegion: [Coord, Coord, Coord, Coord, Coord];
82 | coveringRegion: [Coord, Coord, Coord, Coord, Coord];
83 | }) => void;
84 | onMapClick?: (event: {
85 | x: number;
86 | y: number;
87 | latitude: number;
88 | longitude: number;
89 | }) => void;
90 | onTouch?: () => void;
91 | showsMyLocationButton?: boolean;
92 | compass?: boolean;
93 | scaleBar?: boolean;
94 | zoomControl?: boolean;
95 | mapType?: MapType;
96 | buildingHeight?: number;
97 | minZoomLevel?: number;
98 | maxZoomLevel?: number;
99 | nightMode?: boolean;
100 | scrollGesturesEnabled?: boolean;
101 | zoomGesturesEnabled?: boolean;
102 | tiltGesturesEnabled?: boolean;
103 | rotateGesturesEnabled?: boolean;
104 | stopGesturesEnabled?: boolean;
105 | liteModeEnabled?: boolean;
106 | useTextureView?: boolean;
107 | }
108 | export default class NaverMapView extends Component {
109 | ref?: RNNaverMapView;
110 | nodeHandle?: null | number;
111 | private resolveRef;
112 | animateToCoordinate: (coord: Coord) => void;
113 | animateToTwoCoordinates: (c1: Coord, c2: Coord) => void;
114 | animateToCoordinates: (coords: Coord[], bounds?: {
115 | top: number;
116 | bottom: number;
117 | left: number;
118 | right: number;
119 | }) => void;
120 | animateToRegion: (region: Region) => void;
121 | setLocationTrackingMode: (mode: number) => void;
122 | setLayerGroupEnabled: (group: LayerGroup, enabled: boolean) => void;
123 | showsMyLocationButton: (show: boolean) => void;
124 | private dispatchViewManagerCommand;
125 | handleOnCameraChange: (event: React.SyntheticEvent<{}, {
126 | latitude: number;
127 | longitude: number;
128 | zoom: number;
129 | contentsRegion: [Coord, Coord, Coord, Coord, Coord];
130 | coveringRegion: [Coord, Coord, Coord, Coord, Coord];
131 | }>) => void;
132 | handleOnMapClick: (event: React.SyntheticEvent<{}, {
133 | x: number;
134 | y: number;
135 | latitude: number;
136 | longitude: number;
137 | }>) => void;
138 | render(): JSX.Element;
139 | }
140 | interface RNNaverMapView extends React.Component<{}, any> {
141 | }
142 | export interface MapOverlay {
143 | coordinate: Coord;
144 | onClick?: () => void;
145 | }
146 | export interface MarkerProps extends MapOverlay {
147 | anchor?: {
148 | x: number;
149 | y: number;
150 | };
151 | pinColor?: string;
152 | rotation?: number;
153 | flat?: boolean;
154 | image?: ImageSourcePropType;
155 | width?: number;
156 | height?: number;
157 | alpha?: number;
158 | angle?: number;
159 | hidden?: boolean;
160 | zIndex?: number;
161 | iconPerspectiveEnabled?: boolean;
162 | isHideCollidedSymbols?: boolean;
163 | isHideCollidedMarkers?: boolean;
164 | isHideCollidedCaptions?: boolean;
165 | isForceShowIcon?: boolean;
166 | animated?: boolean;
167 | caption?: {
168 | text?: string;
169 | align?: Align;
170 | textSize?: number;
171 | color?: string;
172 | haloColor?: string;
173 | offset?: number;
174 | requestedWidth?: number;
175 | minZoom?: number;
176 | maxZoom?: number;
177 | };
178 | subCaption?: {
179 | text?: string;
180 | textSize?: number;
181 | color?: string;
182 | haloColor?: string;
183 | requestedWidth?: number;
184 | minZoom?: number;
185 | maxZoom?: number;
186 | };
187 | }
188 | export declare class Marker extends Component {
189 | render(): JSX.Element;
190 | }
191 | export interface CircleProps extends MapOverlay {
192 | radius?: number;
193 | color?: string;
194 | outlineWidth?: number;
195 | outlineColor?: string;
196 | zIndex?: number;
197 | }
198 | export declare class Circle extends Component {
199 | render(): JSX.Element;
200 | }
201 | interface PolylineProps extends Omit {
202 | coordinates: Coord[];
203 | strokeWidth?: number;
204 | strokeColor?: string;
205 | }
206 | export declare class Polyline extends Component {
207 | render(): JSX.Element;
208 | }
209 | interface PolygonProps extends Omit {
210 | coordinates: Coord[];
211 | outlineWidth?: number;
212 | outlineColor?: string;
213 | color?: string;
214 | holes?: Coord[][];
215 | }
216 | export declare class Polygon extends Component {
217 | render(): JSX.Element;
218 | }
219 | export interface PathProps extends Omit {
220 | coordinates: Coord[];
221 | width?: number;
222 | color?: string;
223 | outlineWidth?: number;
224 | passedColor?: string;
225 | outlineColor?: string;
226 | passedOutlineColor?: string;
227 | pattern?: ImageSourcePropType;
228 | patternInterval?: number;
229 | progress?: number;
230 | zIndex?: number;
231 | }
232 | export declare class Path extends Component {
233 | render(): JSX.Element;
234 | }
235 | export {};
236 |
--------------------------------------------------------------------------------
/example/marker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZeroCho/react-native-naver-map/b2134b45f0db93374863bbb1ead8efc477691c6b/example/marker.png
--------------------------------------------------------------------------------
/example/metro.config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Metro configuration for React Native
3 | * https://github.com/facebook/react-native
4 | *
5 | * @format
6 | */
7 |
8 | module.exports = {
9 | transformer: {
10 | getTransformOptions: async () => ({
11 | transform: {
12 | experimentalImportSupport: false,
13 | inlineRequires: false,
14 | },
15 | }),
16 | },
17 | };
18 |
--------------------------------------------------------------------------------
/example/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "example",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "android": "react-native run-android",
7 | "ios": "react-native run-ios",
8 | "start": "react-native start",
9 | "test": "jest",
10 | "lint": "eslint ."
11 | },
12 | "dependencies": {
13 | "@react-native-community/masked-view": "^0.1.9",
14 | "@react-navigation/bottom-tabs": "^5.2.6",
15 | "@react-navigation/native": "^5.5.0",
16 | "@react-navigation/stack": "^5.4.1",
17 | "react": "16.9.0",
18 | "react-native": "0.61.2",
19 | "react-native-gesture-handler": "^1.6.1",
20 | "react-native-reanimated": "^1.8.0",
21 | "react-native-safe-area-context": "^0.7.3",
22 | "react-native-screens": "^2.4.0"
23 | },
24 | "devDependencies": {
25 | "@babel/core": "^7.6.2",
26 | "@babel/runtime": "^7.6.2",
27 | "@react-native-community/eslint-config": "^0.0.5",
28 | "babel-jest": "^24.9.0",
29 | "eslint": "^6.4.0",
30 | "jest": "^24.9.0",
31 | "metro-react-native-babel-preset": "^0.56.0",
32 | "react-test-renderer": "16.9.0"
33 | },
34 | "jest": {
35 | "preset": "react-native"
36 | },
37 | "resolutions": {
38 | "@react-native-community/cli": "3.0.0-alpha.2",
39 | "@react-native-community/cli-platform-android": "3.0.0-alpha.2",
40 | "@react-native-community/cli-platform-ios": "3.0.0-alpha.2",
41 | "@react-native-community/cli-tools": "2.8.3"
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/example/screenshot/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZeroCho/react-native-naver-map/b2134b45f0db93374863bbb1ead8efc477691c6b/example/screenshot/screenshot.png
--------------------------------------------------------------------------------
/index.d.ts:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { ImageSourcePropType, StyleProp, ViewStyle } from 'react-native';
3 | declare const RNNaverMapView: any;
4 | export interface Coord {
5 | latitude: number;
6 | longitude: number;
7 | }
8 | export interface Region extends Coord {
9 | latitudeDelta: number;
10 | longitudeDelta: number;
11 | }
12 | export declare enum TrackingMode {
13 | None = 0,
14 | NoFollow = 1,
15 | Follow = 2,
16 | Face = 3
17 | }
18 | export declare enum MapType {
19 | Basic = 0,
20 | Navi = 1,
21 | Satellite = 2,
22 | Hybrid = 3,
23 | Terrain = 4
24 | }
25 | export declare enum LayerGroup {
26 | LAYER_GROUP_BUILDING = "building",
27 | LAYER_GROUP_TRANSIT = "transit",
28 | LAYER_GROUP_BICYCLE = "bike",
29 | LAYER_GROUP_TRAFFIC = "ctt",
30 | LAYER_GROUP_CADASTRAL = "landparcel",
31 | LAYER_GROUP_MOUNTAIN = "mountain"
32 | }
33 | export declare enum Gravity {
34 | NO_GRAVITY = 0,
35 | AXIS_SPECIFIED = 1,
36 | AXIS_PULL_BEFORE = 2,
37 | AXIS_PULL_AFTER = 4,
38 | AXIS_X_SHIFT = 0,
39 | AXIS_Y_SHIFT = 4,
40 | TOP = 48,
41 | BOTTOM = 80,
42 | LEFT = 3,
43 | RIGHT = 5,
44 | CENTER_VERTICAL = 16,
45 | CENTER_HORIZONTAL = 1
46 | }
47 | export declare enum Align {
48 | Center = 0,
49 | Left = 1,
50 | Right = 2,
51 | Top = 3,
52 | Bottom = 4,
53 | TopLeft = 5,
54 | TopRight = 6,
55 | BottomRight = 7,
56 | BottomLeft = 8
57 | }
58 | export interface Rect {
59 | left?: number;
60 | top?: number;
61 | right?: number;
62 | bottom?: number;
63 | }
64 | export interface NaverMapViewProps {
65 | style?: StyleProp;
66 | center?: Coord & {
67 | zoom?: number;
68 | tilt?: number;
69 | bearing?: number;
70 | };
71 | tilt?: number;
72 | bearing?: number;
73 | mapPadding?: Rect;
74 | logoMargin?: Rect;
75 | logoGravity?: Gravity;
76 | onInitialized?: Function;
77 | onCameraChange?: (event: {
78 | latitude: number;
79 | longitude: number;
80 | zoom: number;
81 | contentsRegion: [Coord, Coord, Coord, Coord, Coord];
82 | coveringRegion: [Coord, Coord, Coord, Coord, Coord];
83 | }) => void;
84 | onMapClick?: (event: {
85 | x: number;
86 | y: number;
87 | latitude: number;
88 | longitude: number;
89 | }) => void;
90 | onTouch?: () => void;
91 | showsMyLocationButton?: boolean;
92 | compass?: boolean;
93 | scaleBar?: boolean;
94 | zoomControl?: boolean;
95 | mapType?: MapType;
96 | buildingHeight?: number;
97 | minZoomLevel?: number;
98 | maxZoomLevel?: number;
99 | nightMode?: boolean;
100 | scrollGesturesEnabled?: boolean;
101 | zoomGesturesEnabled?: boolean;
102 | tiltGesturesEnabled?: boolean;
103 | rotateGesturesEnabled?: boolean;
104 | stopGesturesEnabled?: boolean;
105 | liteModeEnabled?: boolean;
106 | useTextureView?: boolean;
107 | }
108 | export default class NaverMapView extends Component {
109 | ref?: RNNaverMapView;
110 | nodeHandle?: null | number;
111 | private resolveRef;
112 | animateToCoordinate: (coord: Coord) => void;
113 | animateToTwoCoordinates: (c1: Coord, c2: Coord) => void;
114 | animateToCoordinates: (coords: Coord[], bounds?: {
115 | top: number;
116 | bottom: number;
117 | left: number;
118 | right: number;
119 | }) => void;
120 | animateToRegion: (region: Region) => void;
121 | setLocationTrackingMode: (mode: number) => void;
122 | setLayerGroupEnabled: (group: LayerGroup, enabled: boolean) => void;
123 | showsMyLocationButton: (show: boolean) => void;
124 | private dispatchViewManagerCommand;
125 | handleOnCameraChange: (event: React.SyntheticEvent<{}, {
126 | latitude: number;
127 | longitude: number;
128 | zoom: number;
129 | contentsRegion: [Coord, Coord, Coord, Coord, Coord];
130 | coveringRegion: [Coord, Coord, Coord, Coord, Coord];
131 | }>) => void;
132 | handleOnMapClick: (event: React.SyntheticEvent<{}, {
133 | x: number;
134 | y: number;
135 | latitude: number;
136 | longitude: number;
137 | }>) => void;
138 | render(): JSX.Element;
139 | }
140 | interface RNNaverMapView extends React.Component<{}, any> {
141 | }
142 | export interface MapOverlay {
143 | coordinate: Coord;
144 | onClick?: () => void;
145 | }
146 | export interface MarkerProps extends MapOverlay {
147 | anchor?: {
148 | x: number;
149 | y: number;
150 | };
151 | pinColor?: string;
152 | rotation?: number;
153 | flat?: boolean;
154 | image?: ImageSourcePropType;
155 | width?: number;
156 | height?: number;
157 | alpha?: number;
158 | angle?: number;
159 | hidden?: boolean;
160 | zIndex?: number;
161 | iconPerspectiveEnabled?: boolean;
162 | isHideCollidedSymbols?: boolean;
163 | isHideCollidedMarkers?: boolean;
164 | isHideCollidedCaptions?: boolean;
165 | isForceShowIcon?: boolean;
166 | animated?: boolean;
167 | caption?: {
168 | text?: string;
169 | align?: Align;
170 | textSize?: number;
171 | color?: string;
172 | haloColor?: string;
173 | offset?: number;
174 | requestedWidth?: number;
175 | minZoom?: number;
176 | maxZoom?: number;
177 | };
178 | subCaption?: {
179 | text?: string;
180 | textSize?: number;
181 | color?: string;
182 | haloColor?: string;
183 | requestedWidth?: number;
184 | minZoom?: number;
185 | maxZoom?: number;
186 | };
187 | }
188 | export declare class Marker extends Component {
189 | render(): JSX.Element;
190 | }
191 | export interface CircleProps extends MapOverlay {
192 | radius?: number;
193 | color?: string;
194 | outlineWidth?: number;
195 | outlineColor?: string;
196 | zIndex?: number;
197 | }
198 | export declare class Circle extends Component {
199 | render(): JSX.Element;
200 | }
201 | interface PolylineProps extends Omit {
202 | coordinates: Coord[];
203 | strokeWidth?: number;
204 | strokeColor?: string;
205 | }
206 | export declare class Polyline extends Component {
207 | render(): JSX.Element;
208 | }
209 | interface PolygonProps extends Omit {
210 | coordinates: Coord[];
211 | outlineWidth?: number;
212 | outlineColor?: string;
213 | color?: string;
214 | holes?: Coord[][];
215 | }
216 | export declare class Polygon extends Component {
217 | render(): JSX.Element;
218 | }
219 | export interface PathProps extends Omit {
220 | coordinates: Coord[];
221 | width?: number;
222 | color?: string;
223 | outlineWidth?: number;
224 | passedColor?: string;
225 | outlineColor?: string;
226 | passedOutlineColor?: string;
227 | pattern?: ImageSourcePropType;
228 | patternInterval?: number;
229 | progress?: number;
230 | zIndex?: number;
231 | }
232 | export declare class Path extends Component {
233 | render(): JSX.Element;
234 | }
235 | export {};
236 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { findNodeHandle, Image, NativeModules, Platform, processColor, requireNativeComponent, UIManager, } from 'react-native';
3 | const RNNaverMapView = requireNativeComponent('RNNaverMapView');
4 | const RNNaverMapViewTexture = Platform.select({
5 | android: () => requireNativeComponent('RNNaverMapViewTexture'),
6 | ios: () => RNNaverMapView
7 | })();
8 | const RNNaverMapMarker = requireNativeComponent('RNNaverMapMarker');
9 | const RNNaverMapPathOverlay = requireNativeComponent('RNNaverMapPathOverlay');
10 | const RNNaverMapPolylineOverlay = requireNativeComponent('RNNaverMapPolylineOverlay');
11 | const RNNaverMapCircleOverlay = requireNativeComponent('RNNaverMapCircleOverlay');
12 | const RNNaverMapPolygonOverlay = requireNativeComponent('RNNaverMapPolygonOverlay');
13 | export var TrackingMode;
14 | (function (TrackingMode) {
15 | TrackingMode[TrackingMode["None"] = 0] = "None";
16 | TrackingMode[TrackingMode["NoFollow"] = 1] = "NoFollow";
17 | TrackingMode[TrackingMode["Follow"] = 2] = "Follow";
18 | TrackingMode[TrackingMode["Face"] = 3] = "Face";
19 | })(TrackingMode || (TrackingMode = {}));
20 | export var MapType;
21 | (function (MapType) {
22 | MapType[MapType["Basic"] = 0] = "Basic";
23 | MapType[MapType["Navi"] = 1] = "Navi";
24 | MapType[MapType["Satellite"] = 2] = "Satellite";
25 | MapType[MapType["Hybrid"] = 3] = "Hybrid";
26 | MapType[MapType["Terrain"] = 4] = "Terrain";
27 | })(MapType || (MapType = {}));
28 | export var LayerGroup;
29 | (function (LayerGroup) {
30 | LayerGroup["LAYER_GROUP_BUILDING"] = "building";
31 | LayerGroup["LAYER_GROUP_TRANSIT"] = "transit";
32 | LayerGroup["LAYER_GROUP_BICYCLE"] = "bike";
33 | LayerGroup["LAYER_GROUP_TRAFFIC"] = "ctt";
34 | LayerGroup["LAYER_GROUP_CADASTRAL"] = "landparcel";
35 | LayerGroup["LAYER_GROUP_MOUNTAIN"] = "mountain";
36 | })(LayerGroup || (LayerGroup = {}));
37 | export var Gravity;
38 | (function (Gravity) {
39 | Gravity[Gravity["NO_GRAVITY"] = 0] = "NO_GRAVITY";
40 | Gravity[Gravity["AXIS_SPECIFIED"] = 1] = "AXIS_SPECIFIED";
41 | Gravity[Gravity["AXIS_PULL_BEFORE"] = 2] = "AXIS_PULL_BEFORE";
42 | Gravity[Gravity["AXIS_PULL_AFTER"] = 4] = "AXIS_PULL_AFTER";
43 | Gravity[Gravity["AXIS_X_SHIFT"] = 0] = "AXIS_X_SHIFT";
44 | Gravity[Gravity["AXIS_Y_SHIFT"] = 4] = "AXIS_Y_SHIFT";
45 | Gravity[Gravity["TOP"] = 48] = "TOP";
46 | Gravity[Gravity["BOTTOM"] = 80] = "BOTTOM";
47 | Gravity[Gravity["LEFT"] = 3] = "LEFT";
48 | Gravity[Gravity["RIGHT"] = 5] = "RIGHT";
49 | Gravity[Gravity["CENTER_VERTICAL"] = 16] = "CENTER_VERTICAL";
50 | Gravity[Gravity["CENTER_HORIZONTAL"] = 1] = "CENTER_HORIZONTAL";
51 | })(Gravity || (Gravity = {}));
52 | export var Align;
53 | (function (Align) {
54 | Align[Align["Center"] = 0] = "Center";
55 | Align[Align["Left"] = 1] = "Left";
56 | Align[Align["Right"] = 2] = "Right";
57 | Align[Align["Top"] = 3] = "Top";
58 | Align[Align["Bottom"] = 4] = "Bottom";
59 | Align[Align["TopLeft"] = 5] = "TopLeft";
60 | Align[Align["TopRight"] = 6] = "TopRight";
61 | Align[Align["BottomRight"] = 7] = "BottomRight";
62 | Align[Align["BottomLeft"] = 8] = "BottomLeft";
63 | })(Align || (Align = {}));
64 | export default class NaverMapView extends Component {
65 | constructor() {
66 | super(...arguments);
67 | this.resolveRef = (ref) => {
68 | this.ref = ref;
69 | this.nodeHandle = findNodeHandle(ref);
70 | };
71 | this.animateToCoordinate = (coord) => {
72 | this.dispatchViewManagerCommand('animateToCoordinate', [coord]);
73 | };
74 | this.animateToTwoCoordinates = (c1, c2) => {
75 | this.dispatchViewManagerCommand('animateToTwoCoordinates', [c1, c2]);
76 | };
77 | this.animateToCoordinates = (coords, bounds) => {
78 | this.dispatchViewManagerCommand("animateToCoordinates", [coords, bounds]);
79 | };
80 | this.animateToRegion = (region) => {
81 | this.dispatchViewManagerCommand('animateToRegion', [region]);
82 | };
83 | this.setLocationTrackingMode = (mode) => {
84 | this.dispatchViewManagerCommand('setLocationTrackingMode', [mode]);
85 | };
86 | this.setLayerGroupEnabled = (group, enabled) => {
87 | this.dispatchViewManagerCommand('setLayerGroupEnabled', [group, enabled]);
88 | };
89 | this.showsMyLocationButton = (show) => {
90 | this.dispatchViewManagerCommand('showsMyLocationButton', [show]);
91 | };
92 | this.dispatchViewManagerCommand = (command, arg) => {
93 | return Platform.select({
94 | // @ts-ignore
95 | android: () => UIManager.dispatchViewManagerCommand(this.nodeHandle,
96 | // @ts-ignore
97 | UIManager.getViewManagerConfig('RNNaverMapView').Commands[command], arg),
98 | ios: () => NativeModules[`RNNaverMapView`][command](this.nodeHandle, ...arg),
99 | })();
100 | };
101 | this.handleOnCameraChange = (event) => this.props.onCameraChange && this.props.onCameraChange(event.nativeEvent);
102 | this.handleOnMapClick = (event) => this.props.onMapClick && this.props.onMapClick(event.nativeEvent);
103 | }
104 | render() {
105 | const { onInitialized, center, tilt, bearing, mapPadding, logoMargin, nightMode, useTextureView, } = this.props;
106 | const ViewClass = useTextureView ? RNNaverMapViewTexture : RNNaverMapView;
107 | return React.createElement(ViewClass, 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 }));
108 | }
109 | }
110 | export class Marker extends Component {
111 | render() {
112 | var _a, _b;
113 | return React.createElement(RNNaverMapMarker, Object.assign({}, this.props, { image: getImageUri(this.props.image), caption: this.props.caption && Object.assign(Object.assign({}, this.props.caption), { textSize: (_a = this.props.caption.textSize) !== null && _a !== void 0 ? _a : 12, color: parseColor(this.props.caption.color), haloColor: parseColor(this.props.caption.haloColor) }), subCaption: this.props.subCaption && Object.assign(Object.assign({}, this.props.subCaption), { textSize: (_b = this.props.subCaption.textSize) !== null && _b !== void 0 ? _b : 12, color: parseColor(this.props.subCaption.color), haloColor: parseColor(this.props.subCaption.haloColor) }) }));
114 | }
115 | }
116 | export class Circle extends Component {
117 | render() {
118 | return React.createElement(RNNaverMapCircleOverlay, Object.assign({}, this.props));
119 | }
120 | }
121 | export class Polyline extends Component {
122 | render() {
123 | return React.createElement(RNNaverMapPolylineOverlay, Object.assign({}, this.props));
124 | }
125 | }
126 | export class Polygon extends Component {
127 | render() {
128 | return Platform.select({
129 | android: () => React.createElement(RNNaverMapPolygonOverlay, Object.assign({}, this.props)),
130 | ios: () => React.createElement(RNNaverMapPolygonOverlay, Object.assign({}, this.props, { coordinates: {
131 | exteriorRing: this.props.coordinates,
132 | interiorRings: this.props.holes,
133 | } }))
134 | })();
135 | }
136 | }
137 | export class Path extends Component {
138 | render() {
139 | return React.createElement(RNNaverMapPathOverlay, Object.assign({}, this.props, { pattern: getImageUri(this.props.pattern) }));
140 | }
141 | }
142 | function getImageUri(src) {
143 | let imageUri = null;
144 | if (src) {
145 | let image = Image.resolveAssetSource(src) || { uri: null };
146 | imageUri = image.uri;
147 | }
148 | return imageUri;
149 | }
150 | function parseColor(color) {
151 | if (color && Platform.OS === 'ios')
152 | return processColor(color);
153 | return color;
154 | }
155 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RCTConvert+NMFMapView.h:
--------------------------------------------------------------------------------
1 | //
2 | // RCTConvert+RNNaverMapView.h
3 | //
4 | // Created by flask on 14/04/2019.
5 | // Copyright © 2019 flask. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | #import
11 | #import
12 |
13 | @interface RCTConvert(NMFMapView)
14 |
15 | + (NMFCameraUpdate *) NMFCameraUpdate: (id) json;
16 | + (NMFCameraUpdate *) NMFCameraUpdateWith: (id) json;
17 | + (NMGLatLng *) NMGLatLng: (id)json;
18 | + (NMGLatLngBounds *) NMGLatLngBounds: (id)json;
19 | + (NMFAlignType *) NMFAlignType: (id)json;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RCTConvert+NMFMapView.m:
--------------------------------------------------------------------------------
1 | //
2 | // RCTConvert+RNNaverMapView.m
3 | //
4 | // Created by flask on 14/04/2019.
5 | // Copyright © 2019 flask. All rights reserved.
6 | //
7 |
8 | #import
9 | #import
10 | #import
11 |
12 | #import "RCTConvert+NMFMapView.h"
13 |
14 | @implementation RCTConvert(NMFMapView)
15 |
16 | + (NMFCameraUpdate*) NMFCameraUpdate: (id)json
17 | {
18 | json = [self NSDictionary:json];
19 | return [NMFCameraUpdate cameraUpdateWithScrollTo:NMGLatLngMake([self double: json[@"latitude"]], [self double:json[@"longitude"]])
20 | zoomTo:[self double: json[@"zoom"]]];
21 | }
22 |
23 | + (NMFCameraUpdate*) NMFCameraUpdateWith:(id)json
24 | {
25 | NMGLatLng *position = NMGLatLngMake([self double: json[@"latitude"]], [self double:json[@"longitude"]]);
26 | double zoom = [self double: json[@"zoom"]];
27 | double tilt = [self double: json[@"tilt"]];
28 | double bearing = [self double: json[@"bearing"]];
29 |
30 | NMFCameraPosition* cameraPosition = [NMFCameraPosition cameraPosition:position zoom:zoom tilt:tilt heading:bearing];
31 | NMFCameraUpdate *cameraUpdate = [NMFCameraUpdate cameraUpdateWithPosition: cameraPosition];
32 | cameraUpdate.animation = NMFCameraUpdateAnimationEaseIn;
33 | return cameraUpdate;
34 | }
35 |
36 | + (NMGLatLng*) NMGLatLng: (id)json
37 | {
38 | json = [self NSDictionary:json];
39 | return NMGLatLngMake([self double: json[@"latitude"]], [self double:json[@"longitude"]]);
40 | }
41 |
42 | + (NMGLatLngBounds*) NMGLatLngBounds: (id)json
43 | {
44 | json = [self NSDictionary:json];
45 | double lat = [self double: json[@"latitude"]];
46 | double latDelta = [self double: json[@"latitudeDelta"]];
47 | double lng = [self double: json[@"longitude"]];
48 | double lngDelta = [self double: json[@"longitudeDelta"]];
49 | return NMGLatLngBoundsMake(lat - latDelta / 2, lng - lngDelta / 2, // southwest
50 | lat + latDelta / 2, lng + lngDelta / 2); // northeast
51 | }
52 |
53 | + (NMFAlignType *) NMFAlignType: (id)json
54 | {
55 | json = [self NSNumber:json];
56 | if ([json isEqual: @(0)]) return NMFAlignType.center;
57 | if ([json isEqual: @(1)]) return NMFAlignType.left;
58 | if ([json isEqual: @(2)]) return NMFAlignType.right;
59 | if ([json isEqual: @(3)]) return NMFAlignType.top;
60 | if ([json isEqual: @(4)]) return NMFAlignType.bottom;
61 | if ([json isEqual: @(5)]) return NMFAlignType.topLeft;
62 | if ([json isEqual: @(6)]) return NMFAlignType.topRight;
63 | if ([json isEqual: @(7)]) return NMFAlignType.bottomRight;
64 | if ([json isEqual: @(8)]) return NMFAlignType.bottomLeft;
65 |
66 | return NMFAlignType.bottom;
67 | }
68 |
69 | @end
70 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RNNaverMapCircleOverlay.h:
--------------------------------------------------------------------------------
1 | //
2 | // RNNaverMapCircleOverlay.h
3 | //
4 | // Created by flask on 17/03/2020.
5 | // Copyright © 2020 flask. All rights reserved.
6 | //
7 |
8 | #import
9 | #import
10 | #import
11 |
12 | #import "RCTConvert+NMFMapView.h"
13 |
14 | @interface RNNaverMapCircleOverlay : UIView
15 |
16 | @property (nonatomic, weak) RCTBridge *bridge;
17 | @property (nonatomic, strong) NMFCircleOverlay *realOverlay;
18 | @property (nonatomic, strong) NMFCircleOverlay *oldOverlay;
19 |
20 | @property (nonatomic, assign) NMGLatLng *coordinate;
21 | @property (nonatomic, assign) CGFloat radius;
22 | @property (nonatomic, strong) UIColor *color;
23 | @property (nonatomic, assign) CGFloat outlineWidth;
24 | @property (nonatomic, strong) UIColor *outlineColor;
25 | @property (nonatomic, assign) NSInteger zIndex;
26 | @property (nonatomic, copy) RCTDirectEventBlock onClick;
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RNNaverMapCircleOverlay.m:
--------------------------------------------------------------------------------
1 | //
2 | // RNNaverMapCircleOverlay.m
3 | //
4 | // Created by flask on 17/03/2020.
5 | // Copyright © 2020 flask. All rights reserved.
6 | //
7 |
8 | #import "RNNaverMapCircleOverlay.h"
9 |
10 | #import
11 | #import
12 | #import
13 | #import
14 |
15 | #import "RCTConvert+NMFMapView.h"
16 |
17 | @implementation RNNaverMapCircleOverlay {
18 | }
19 |
20 | - (instancetype)init
21 | {
22 | if ((self = [super init])) {
23 | _realOverlay = [NMFCircleOverlay circleOverlay:NMGLatLngMake(37.5666102, 126.9783881) radius:100];
24 | }
25 | return self;
26 | }
27 |
28 | - (void)setCoordinate:(NMGLatLng*) coordinate {
29 | // FIXME coordinate 변경이 제대로 반영이 안되는 문제가 있어 새로 객체 할당하는 방법으로 임시 수정
30 | _oldOverlay = _realOverlay;
31 | _realOverlay = [NMFCircleOverlay circleOverlay:coordinate radius:_realOverlay.radius];
32 | _realOverlay.fillColor = _oldOverlay.fillColor;
33 | _realOverlay.outlineColor = _oldOverlay.outlineColor;
34 | _realOverlay.outlineWidth = _oldOverlay.outlineWidth;
35 | _realOverlay.zIndex = _oldOverlay.zIndex;
36 | _realOverlay.mapView = _oldOverlay.mapView;
37 | _oldOverlay.mapView = nil;
38 |
39 | __block RNNaverMapCircleOverlay *this = self;
40 | _realOverlay.touchHandler = ^BOOL(NMFOverlay *overlay) {
41 | if (this.onClick != nil) {
42 | this.onClick(@{});
43 | return YES;
44 | }
45 | return NO;
46 | };
47 | }
48 |
49 | - (void)setRadius:(CGFloat) radius {
50 | _realOverlay.radius = radius;
51 | }
52 |
53 | - (void)setColor:(UIColor*) color {
54 | _realOverlay.fillColor = color;
55 | }
56 |
57 | - (void)setOutlineWidth:(CGFloat) outlineWidth {
58 | _realOverlay.outlineWidth = outlineWidth;
59 | }
60 |
61 | - (void)setOutlineColor:(UIColor*) outlineColor {
62 | _realOverlay.outlineColor = outlineColor;
63 | }
64 |
65 | - (void)setZIndex:(NSInteger) zIndex {
66 | _realOverlay.zIndex = zIndex;
67 | }
68 |
69 | @end
70 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RNNaverMapCircleOverlayManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // RNNaverMapCircleOverlayManager.h
3 | //
4 | // Created by flask on 17/03/2020.
5 | // Copyright © 2020 flask. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | @interface RNNaverMapCircleOverlayManager : RCTViewManager
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RNNaverMapCircleOverlayManager.m:
--------------------------------------------------------------------------------
1 | //
2 | // RNNaverMapCircleOverlayManager.m
3 | //
4 | // Created by flask on 17/03/2020.
5 | // Copyright © 2020 flask. All rights reserved.
6 | //
7 |
8 | #import "RNNaverMapCircleOverlayManager.h"
9 | #import "RNNaverMapCircleOverlay.h"
10 | #import
11 |
12 | #import "RCTConvert+NMFMapView.h"
13 |
14 | @implementation RNNaverMapCircleOverlayManager
15 |
16 | RCT_EXPORT_MODULE()
17 |
18 | - (UIView *)view
19 | {
20 | RNNaverMapCircleOverlay *overlay = [RNNaverMapCircleOverlay new];
21 | overlay.bridge = self.bridge;
22 | return overlay;
23 | }
24 |
25 | RCT_EXPORT_VIEW_PROPERTY(coordinate, NMGLatLng)
26 | RCT_EXPORT_VIEW_PROPERTY(radius, CGFloat)
27 | RCT_EXPORT_VIEW_PROPERTY(color, UIColor)
28 | RCT_EXPORT_VIEW_PROPERTY(outlineWidth, CGFloat)
29 | RCT_EXPORT_VIEW_PROPERTY(outlineColor, UIColor)
30 | RCT_EXPORT_VIEW_PROPERTY(zIndex, NSInteger)
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RNNaverMapMarker.h:
--------------------------------------------------------------------------------
1 | //
2 | // RNNaverMapMarker.h
3 | //
4 | // Created by flask on 18/04/2019.
5 | // Copyright © 2019 flask. All rights reserved.
6 | //
7 |
8 | #import
9 | #import
10 | #import
11 |
12 | #import "RCTConvert+NMFMapView.h"
13 |
14 | @interface RNNaverMapMarker : UIView
15 |
16 | @property (nonatomic, weak) RCTBridge *bridge;
17 | @property (nonatomic, strong) NMFMarker *realMarker;
18 | @property (nonatomic, assign) NMGLatLng *coordinate;
19 | @property (nonatomic, assign) CGFloat width;
20 | @property (nonatomic, assign) CGFloat height;
21 | @property (nonatomic, assign) NSInteger zIndex;
22 | @property (nonatomic, assign) BOOL hidden;
23 | @property (nonatomic, assign) CGFloat angle;
24 | @property (nonatomic, assign) BOOL flatEnabled;
25 | @property (nonatomic, assign) BOOL iconPerspectiveEnabled;
26 | @property (nonatomic, assign) BOOL isHideCollidedSymbols;
27 | @property (nonatomic, assign) BOOL isHideCollidedMarkers;
28 | @property (nonatomic, assign) BOOL isHideCollidedCaptions;
29 | @property (nonatomic, assign) BOOL isForceShowIcon;
30 | @property (nonatomic, assign) CGFloat rotation;
31 | @property (nonatomic, copy) NSString *image;
32 | @property (nonatomic, strong) UIColor *pinColor;
33 | @property (nonatomic, assign) CGFloat alpha;
34 | @property (nonatomic, assign) CGPoint anchor;
35 | @property (nonatomic, copy) RCTDirectEventBlock onClick;
36 |
37 | - (void)setCaptionText:(NSString *) text;
38 | - (void)setCaptionTextSize:(CGFloat) size;
39 | - (void)setCaptionColor:(UIColor *) color;
40 | - (void)setCaptionHaloColor:(UIColor *) color;
41 | - (void)setCaptionAligns:(NSArray *) aligns;
42 | - (void)setCaptionOffset:(CGFloat) offset;
43 | - (void)setCaptionRequestedWidth:(CGFloat) captionWidth;
44 | - (void)setCaptionMinZoom:(double) minZoom;
45 | - (void)setCaptionMaxZoom:(double) maxZoom;
46 | - (void)setSubCaptionText:(NSString *) subText;
47 | - (void)setSubCaptionTextSize:(CGFloat) subTextSize;
48 | - (void)setSubCaptionColor:(UIColor *) subColor;
49 | - (void)setSubCaptionHaloColor:(UIColor *) subHaloColor;
50 | - (void)setSubCaptionRequestedWidth:(CGFloat) subCaptionWidth;
51 | - (void)setSubCaptionMinZoom:(double) subMinZoom;
52 | - (void)setSubCaptionMaxZoom:(double) subMaxZoom;
53 | @end
54 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RNNaverMapMarker.m:
--------------------------------------------------------------------------------
1 | //
2 | // RNNaverMapMarker.m
3 | //
4 | // Created by flask on 18/04/2019.
5 | // Copyright © 2019 flask. All rights reserved.
6 | //
7 |
8 | #import "RNNaverMapMarker.h"
9 |
10 | #import
11 | #import
12 | #import
13 | #import
14 | #import
15 | #import
16 |
17 | #import "RCTConvert+NMFMapView.h"
18 |
19 | @implementation RNNaverMapMarker {
20 | RCTImageLoaderCancellationBlock _reloadImageCancellationBlock;
21 | __weak UIImageView *_iconImageView;
22 | UIView *_iconView;
23 | }
24 |
25 | static NSMutableDictionary *_overlayImageHolder;
26 |
27 | +(void)initialize {
28 | _overlayImageHolder = [[NSMutableDictionary alloc] init];
29 | }
30 |
31 | - (instancetype)init
32 | {
33 | if ((self = [super init])) {
34 | _realMarker = [NMFMarker new];
35 |
36 | __block RNNaverMapMarker *this = self;
37 | _realMarker.touchHandler = ^BOOL(NMFOverlay *overlay) {
38 | if (this.onClick != nil) {
39 | this.onClick(@{});
40 | return YES;
41 | }
42 | return NO;
43 | };
44 | }
45 | return self;
46 | }
47 |
48 | - (void)setZIndex:(NSInteger) zIndex {
49 | _realMarker.zIndex = zIndex;
50 | }
51 |
52 | - (void)setHidden:(BOOL) hidden {
53 | _realMarker.hidden = hidden;
54 | }
55 |
56 | - (void)setCoordinate:(NMGLatLng*) coordinate {
57 | _realMarker.position = coordinate;
58 | }
59 |
60 | - (void)setWidth:(CGFloat) width {
61 | _realMarker.width = width;
62 | }
63 |
64 | - (void)setHeight:(CGFloat) height {
65 | _realMarker.height = height;
66 | }
67 |
68 | - (void)setRotation:(CGFloat) rotation {
69 | _realMarker.angle = rotation;
70 | }
71 |
72 | - (void)setPinColor:(UIColor *) pinColor {
73 | _realMarker.iconTintColor = pinColor;
74 | }
75 |
76 | - (void)setAlpha:(CGFloat) alpha {
77 | _realMarker.alpha = alpha;
78 | }
79 |
80 | - (void)setAnchor:(CGPoint) anchor {
81 | _anchor = anchor;
82 | _realMarker.anchor = anchor;
83 | }
84 |
85 | - (void)setAngle:(CGFloat) angle {
86 | _realMarker.angle = angle;
87 | }
88 |
89 | - (void)setFlatEnabled:(BOOL) flatEnabled {
90 | _realMarker.flat = flatEnabled;
91 | }
92 |
93 | - (void)setIconPerspectiveEnabled:(BOOL) iconPerspectiveEnabled {
94 | _realMarker.iconPerspectiveEnabled = iconPerspectiveEnabled;
95 | }
96 |
97 | - (void)setisHideCollidedSymbols:(BOOL) isHideCollidedSymbols {
98 | _realMarker.isHideCollidedSymbols = isHideCollidedSymbols;
99 | }
100 |
101 | - (void)setIsHideCollidedMarkers:(BOOL) isHideCollidedMarkers {
102 | _realMarker.isHideCollidedMarkers = isHideCollidedMarkers;
103 | }
104 |
105 | - (void)setIsHideCollidedCaptions:(BOOL) isHideCollidedCaptions {
106 | _realMarker.isHideCollidedCaptions = isHideCollidedCaptions;
107 | }
108 |
109 | - (void)isForceShowIcon:(BOOL) isForceShowIcon {
110 | _realMarker.isForceShowIcon = isForceShowIcon;
111 | }
112 |
113 |
114 | - (void)setMapView:(NMFMapView*) mapView {
115 | _realMarker.mapView = mapView;
116 | }
117 |
118 | - (void)setCaptionText:(NSString *) text {
119 | _realMarker.captionText = text;
120 | }
121 |
122 | - (void)setCaptionTextSize:(CGFloat) size {
123 | _realMarker.captionTextSize = size;
124 | }
125 |
126 | - (void)setCaptionColor:(UIColor *) color {
127 | _realMarker.captionColor = color == nil ? UIColor.blackColor : color;
128 | }
129 |
130 | - (void)setCaptionHaloColor:(UIColor *) haloColor {
131 | _realMarker.captionHaloColor = haloColor == nil ? UIColor.whiteColor : haloColor;
132 | }
133 |
134 | - (void)setCaptionAligns:(NSArray *) aligns {
135 | _realMarker.captionAligns = aligns;
136 | }
137 |
138 | - (void)setCaptionOffset:(CGFloat) offset {
139 | _realMarker.captionOffset = offset;
140 | }
141 | - (void)setCaptionRequestedWidth:(CGFloat) captionWidth {
142 | _realMarker.captionRequestedWidth = captionWidth;
143 | }
144 |
145 | - (void)setCaptionMinZoom:(double) minZoom {
146 | _realMarker.captionMinZoom = minZoom;
147 | }
148 |
149 | - (void)setCaptionMaxZoom:(double) maxZoom {
150 | _realMarker.captionMaxZoom = maxZoom;
151 | }
152 |
153 | - (void)setSubCaptionText:(NSString *) subText {
154 | _realMarker.subCaptionText = subText;
155 | }
156 |
157 | - (void)setSubCaptionTextSize:(CGFloat) subTextSize {
158 | _realMarker.subCaptionTextSize = subTextSize;
159 | }
160 |
161 | - (void)setSubCaptionColor:(UIColor *) subColor {
162 | _realMarker.subCaptionColor = subColor == nil ? UIColor.blackColor : subColor;
163 | }
164 |
165 | - (void)setSubCaptionHaloColor:(UIColor *) subHaloColor {
166 | _realMarker.subCaptionHaloColor = subHaloColor == nil ? UIColor.whiteColor : subHaloColor;
167 | }
168 |
169 | - (void)setSubCaptionRequestedWidth:(CGFloat) subCaptionWidth {
170 | _realMarker.subCaptionRequestedWidth = subCaptionWidth;
171 | }
172 |
173 | - (void)setSubCaptionMinZoom:(double) subMinZoom {
174 | _realMarker.subCaptionMinZoom = subMinZoom;
175 | }
176 |
177 | - (void)setSubCaptionMaxZoom:(double) subMaxZoom {
178 | _realMarker.subCaptionMaxZoom = subMaxZoom;
179 | }
180 |
181 | - (void)setImage:(NSString *) image
182 | {
183 | _image = image;
184 |
185 | if (_reloadImageCancellationBlock) {
186 | _reloadImageCancellationBlock();
187 | _reloadImageCancellationBlock = nil;
188 | }
189 |
190 | if (!_image) {
191 | if (_iconImageView) [_iconImageView removeFromSuperview];
192 | return;
193 | }
194 |
195 | NMFOverlayImage *overlayImage = [_overlayImageHolder valueForKey:image];
196 | if (overlayImage != nil) {
197 | if (self->_iconImageView) [self->_iconImageView removeFromSuperview];
198 | self->_realMarker.iconImage = overlayImage;
199 | return;
200 | }
201 |
202 | _reloadImageCancellationBlock = [[_bridge moduleForClass:[RCTImageLoader class]] loadImageWithURLRequest:[RCTConvert NSURLRequest:_image]
203 | size:self.bounds.size
204 | scale:RCTScreenScale()
205 | clipped:YES
206 | resizeMode:RCTResizeModeCenter
207 | progressBlock:nil
208 | partialLoadBlock:nil
209 | completionBlock:^(NSError *error, UIImage *image) {
210 | if (error) {
211 | NSLog(@"%@", error);
212 | return;
213 | }
214 | dispatch_async(dispatch_get_main_queue(), ^{
215 | if (self->_iconImageView) [self->_iconImageView removeFromSuperview];
216 | NMFOverlayImage *overlayImage = [NMFOverlayImage overlayImageWithImage: image];
217 | self->_realMarker.iconImage = overlayImage;
218 |
219 | [_overlayImageHolder setObject:overlayImage forKey:self->_image];
220 | });
221 | }];
222 | }
223 |
224 | @end
225 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RNNaverMapMarkerManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // RNNaverMapMarkerManager.h
3 | //
4 | // Created by flask on 18/04/2019.
5 | // Copyright © 2019 flask. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | @interface RNNaverMapMarkerManager : RCTViewManager
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RNNaverMapMarkerManager.m:
--------------------------------------------------------------------------------
1 | //
2 | // RNNaverMapMarkerManager.m
3 | //
4 | // Created by flask on 18/04/2019.
5 | // Copyright © 2019 flask. All rights reserved.
6 | //
7 |
8 | #import "RNNaverMapMarkerManager.h"
9 | #import "RNNaverMapMarker.h"
10 | #import
11 | #import
12 |
13 | #import "RCTConvert+NMFMapView.h"
14 |
15 | @implementation RNNaverMapMarkerManager
16 |
17 | RCT_EXPORT_MODULE()
18 |
19 | - (UIView *)view
20 | {
21 | RNNaverMapMarker *marker = [RNNaverMapMarker new];
22 | marker.bridge = self.bridge;
23 | return marker;
24 | }
25 |
26 | RCT_CUSTOM_VIEW_PROPERTY(caption, NSDictionary, RNNaverMapMarker)
27 | {
28 | NSDictionary *dic = [RCTConvert NSDictionary:json];
29 | NSString *text = [RCTConvert NSString:dic[@"text"]];
30 | CGFloat textSize = [RCTConvert CGFloat:dic[@"textSize"]];
31 | UIColor *color = [RCTConvert UIColor:dic[@"color"]];
32 | UIColor *haloColor = [RCTConvert UIColor:dic[@"haloColor"]];
33 | CGFloat offset = [RCTConvert CGFloat:dic[@"offset"]];
34 | CGFloat requestedWidth = [RCTConvert CGFloat:dic[@"requestedWidth"]];
35 | double minZoom = dic[@"minZoom"] ? [RCTConvert double:dic[@"minZoom"]] : NMF_MIN_ZOOM;
36 | double maxZoom = dic[@"maxZoom"] ? [RCTConvert double:dic[@"maxZoom"]] : NMF_MAX_ZOOM;
37 | NMFAlignType *align = [RCTConvert NMFAlignType:dic[@"align"]];
38 | NSMutableArray *alignTypes = [NSMutableArray arrayWithCapacity: 1];
39 |
40 | [alignTypes addObject: align];
41 | [view setCaptionText: text];
42 | [view setCaptionTextSize:textSize];
43 | [view setCaptionColor:color];
44 | [view setCaptionHaloColor:haloColor];
45 | [view setCaptionOffset:offset];
46 | [view setCaptionRequestedWidth:requestedWidth];
47 | [view setCaptionMinZoom:minZoom];
48 | [view setCaptionMaxZoom:maxZoom];
49 | [view setCaptionAligns:alignTypes];
50 | }
51 |
52 | RCT_CUSTOM_VIEW_PROPERTY(subCaption, NSDictionary, RNNaverMapMarker)
53 | {
54 | NSDictionary *dic = [RCTConvert NSDictionary:json];
55 | NSString *text = [RCTConvert NSString:dic[@"text"]];
56 | CGFloat textSize = [RCTConvert CGFloat:dic[@"textSize"]];
57 | UIColor *color = [RCTConvert UIColor:dic[@"color"]];
58 | UIColor *haloColor = [RCTConvert UIColor:dic[@"haloColor"]];
59 | CGFloat requestedWidth = [RCTConvert CGFloat:dic[@"requestedWidth"]];
60 | double minZoom = dic[@"minZoom"] ? [RCTConvert double:dic[@"minZoom"]] : NMF_MIN_ZOOM;
61 | double maxZoom = dic[@"maxZoom"] ? [RCTConvert double:dic[@"maxZoom"]] : NMF_MAX_ZOOM;
62 |
63 | [view setSubCaptionText: text];
64 | [view setSubCaptionTextSize:textSize];
65 | [view setSubCaptionColor:color];
66 | [view setSubCaptionHaloColor:haloColor];
67 | [view setSubCaptionRequestedWidth:requestedWidth];
68 | [view setSubCaptionMinZoom:minZoom];
69 | [view setSubCaptionMaxZoom:maxZoom];
70 | }
71 |
72 |
73 |
74 | RCT_EXPORT_VIEW_PROPERTY(coordinate, NMGLatLng)
75 | RCT_EXPORT_VIEW_PROPERTY(width, CGFloat)
76 | RCT_EXPORT_VIEW_PROPERTY(height, CGFloat)
77 | RCT_EXPORT_VIEW_PROPERTY(zIndex, NSInteger)
78 | RCT_EXPORT_VIEW_PROPERTY(hidden, BOOL)
79 | RCT_EXPORT_VIEW_PROPERTY(angle, CGFloat)
80 | RCT_EXPORT_VIEW_PROPERTY(flatEnabled, BOOL)
81 | RCT_EXPORT_VIEW_PROPERTY(iconPerspectiveEnabled, BOOL)
82 | RCT_EXPORT_VIEW_PROPERTY(isHideCollidedSymbols, BOOL)
83 | RCT_EXPORT_VIEW_PROPERTY(isHideCollidedMarkers, BOOL)
84 | RCT_EXPORT_VIEW_PROPERTY(isHideCollidedCaptions, BOOL)
85 | RCT_EXPORT_VIEW_PROPERTY(isForceShowIcon, BOOL)
86 | RCT_EXPORT_VIEW_PROPERTY(rotation, CGFloat)
87 | RCT_EXPORT_VIEW_PROPERTY(image, NSString)
88 | RCT_EXPORT_VIEW_PROPERTY(pinColor, UIColor)
89 | RCT_EXPORT_VIEW_PROPERTY(alpha, CGFloat)
90 | RCT_EXPORT_VIEW_PROPERTY(anchor, CGPoint)
91 |
92 | @end
93 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RNNaverMapPathOverlay.h:
--------------------------------------------------------------------------------
1 | //
2 | // RNNaverMapPolylineOverlay.h
3 | //
4 | // Created by flask on 18/04/2019.
5 | // Copyright © 2019 flask. All rights reserved.
6 | //
7 |
8 | #import
9 | #import
10 | #import
11 |
12 | #import "RCTConvert+NMFMapView.h"
13 |
14 | @interface RNNaverMapPathOverlay : UIView
15 |
16 | @property (nonatomic, weak) RCTBridge *bridge;
17 | @property (nonatomic, strong) NMFPath *realOverlay;
18 |
19 | @property (nonatomic, assign) NSArray *coordinates;
20 | @property (nonatomic, assign) CGFloat width;
21 | @property (nonatomic, assign) UIColor* color;
22 | @property (nonatomic, assign) CGFloat outlineWidth;
23 | @property (nonatomic, assign) UIColor* passedColor;
24 | @property (nonatomic, assign) UIColor* outlineColor;
25 | @property (nonatomic, assign) UIColor* passedOutlineColor;
26 | @property (nonatomic, assign) NSString* pattern;
27 | @property (nonatomic, assign) CGFloat patternInterval;
28 | @property (nonatomic, copy) RCTDirectEventBlock onClick;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RNNaverMapPathOverlay.m:
--------------------------------------------------------------------------------
1 | //
2 | // RNNaverMapPolylineOverlay.m
3 | //
4 | // Created by flask on 18/04/2019.
5 | // Copyright © 2019 flask. All rights reserved.
6 | //
7 | #import "RNNaverMapPathOverlay.h"
8 |
9 | #import
10 | #import
11 | #import
12 | #import
13 | #import
14 | #import
15 |
16 | #import "RCTConvert+NMFMapView.h"
17 |
18 | @implementation RNNaverMapPathOverlay {
19 | RCTImageLoaderCancellationBlock _reloadImageCancellationBlock;
20 | }
21 |
22 | - (instancetype)init
23 | {
24 | if ((self = [super init])) {
25 | _realOverlay = [NMFPath new];
26 |
27 | __block RNNaverMapPathOverlay *this = self;
28 | _realOverlay.touchHandler = ^BOOL(NMFOverlay *overlay) {
29 | if (this.onClick != nil) {
30 | this.onClick(@{});
31 | return YES;
32 | }
33 | return NO;
34 | };
35 | }
36 | return self;
37 | }
38 |
39 | - (void)setCoordinates:(NSArray*) coordinates {
40 | _realOverlay.path = [NMGLineString lineStringWithPoints:coordinates];
41 | }
42 |
43 | - (void) setWidth: (CGFloat) width {
44 | _realOverlay.width = width;
45 | }
46 |
47 | - (void) setColor: (UIColor*) color {
48 | _realOverlay.color = color;
49 | }
50 |
51 | - (void) setOutlineWidth: (CGFloat) outlineWidth {
52 | _realOverlay.outlineWidth = outlineWidth;
53 | }
54 |
55 | - (void) setPassedColor: (UIColor*) passedColor {
56 | _realOverlay.passedColor = passedColor;
57 | }
58 |
59 | - (void) setOutlineColor: (UIColor*) outlineColor {
60 | _realOverlay.outlineColor = outlineColor;
61 | }
62 |
63 | - (void) setPassedOutlineColor: (UIColor*) passedOutlineColor {
64 | _realOverlay.passedOutlineColor = passedOutlineColor;
65 | }
66 |
67 | - (void) setPattern: (NSString*) pattern {
68 | if (_reloadImageCancellationBlock) {
69 | _reloadImageCancellationBlock();
70 | _reloadImageCancellationBlock = nil;
71 | }
72 |
73 | _reloadImageCancellationBlock = [[_bridge moduleForClass:[RCTImageLoader class]] loadImageWithURLRequest:[RCTConvert NSURLRequest:pattern]
74 | size:self.bounds.size
75 | scale:RCTScreenScale()
76 | clipped:YES
77 | resizeMode:RCTResizeModeCenter
78 | progressBlock:nil
79 | partialLoadBlock:nil
80 | completionBlock:^(NSError *error, UIImage *image) {
81 | if (error) {
82 | NSLog(@"%@", error);
83 | }
84 | dispatch_async(dispatch_get_main_queue(), ^{
85 | self->_realOverlay.patternIcon = [NMFOverlayImage overlayImageWithImage: image];
86 | });
87 | }];
88 | }
89 |
90 | - (void) setPatternInterval: (CGFloat) patternInterval {
91 | _realOverlay.patternInterval = patternInterval;
92 | }
93 |
94 | @end
95 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RNNaverMapPathOverlayManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // RNNaverMapPolylineOverlayManager.h
3 | //
4 | // Created by flask on 19/04/2019.
5 | // Copyright © 2019 flask. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | @interface RNNaverMapPathOverlayManager : RCTViewManager
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RNNaverMapPathOverlayManager.m:
--------------------------------------------------------------------------------
1 | //
2 | // RNNaverMapPolylineOverlayManager.m
3 | //
4 | // Created by flask on 19/04/2019.
5 | // Copyright © 2019 flask. All rights reserved.
6 | //
7 |
8 | #import "RNNaverMapPathOverlayManager.h"
9 | #import "RNNaverMapPathOverlay.h"
10 | #import
11 |
12 | #import "RCTConvert+NMFMapView.h"
13 |
14 | @implementation RNNaverMapPathOverlayManager
15 |
16 | RCT_EXPORT_MODULE()
17 |
18 | - (UIView *)view
19 | {
20 | RNNaverMapPathOverlay *overlay = [RNNaverMapPathOverlay new];
21 | overlay.bridge = self.bridge;
22 | return overlay;
23 | }
24 |
25 | RCT_CUSTOM_VIEW_PROPERTY(coordinates, NSArray, RNNaverMapPathOverlay) {
26 | NSArray *inputArray = [RCTConvert NSArray:json];
27 | NSUInteger size = inputArray.count;
28 | NSMutableArray *points = [NSMutableArray arrayWithCapacity: size];
29 | for (int i=0; i
10 | #import
11 | #import
12 |
13 | #import "RCTConvert+NMFMapView.h"
14 |
15 | @interface RNNaverMapPolygonOverlay : UIView
16 |
17 | @property (nonatomic, weak) RCTBridge *bridge;
18 | @property (nonatomic, strong) NMFPolygonOverlay *realOverlay;
19 |
20 | @property (nonatomic, strong) UIColor *color;
21 | @property (nonatomic, strong) UIColor *outlineColor;
22 | @property (nonatomic, assign) CGFloat outlineWidth;
23 | @property (nonatomic, copy) RCTDirectEventBlock onClick;
24 |
25 | - (void)setPolygonWithRing:(NMGLineString*) exteriorRing interiorRings:(NSArray*) interiorRings;
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RNNaverMapPolygonOverlay.m:
--------------------------------------------------------------------------------
1 | //
2 | // RNNaverMapPolygonOverlay.m
3 | // reactNativeNMap
4 | //
5 | // Created by Flask on 2020/03/26.
6 | // Copyright © 2020 flask. All rights reserved.
7 | //
8 |
9 | #import "RNNaverMapPolygonOverlay.h"
10 |
11 | #import
12 | #import
13 | #import
14 | #import
15 | #import
16 |
17 | #import "RCTConvert+NMFMapView.h"
18 |
19 | @implementation RNNaverMapPolygonOverlay {
20 | }
21 |
22 | - (instancetype)init
23 | {
24 | if ((self = [super init])) {
25 | _realOverlay = [NMFPolygonOverlay new];
26 |
27 | __block RNNaverMapPolygonOverlay *this = self;
28 | _realOverlay.touchHandler = ^BOOL(NMFOverlay *overlay) {
29 | if (this.onClick != nil) {
30 | this.onClick(@{});
31 | return YES;
32 | }
33 | return NO;
34 | };
35 | }
36 | return self;
37 | }
38 |
39 | - (void)setPolygonWithRing:(NMGLineString*) exteriorRing interiorRings:(NSArray*) interiorRings {
40 | _realOverlay.polygon = [NMGPolygon polygonWithRing:exteriorRing interiorRings:interiorRings];
41 | }
42 |
43 | - (void)setOutlineWidth:(CGFloat) outlineWidth {
44 | _realOverlay.outlineWidth = outlineWidth;
45 | }
46 |
47 | - (void)setOutlineColor:(UIColor*) outlineColor {
48 | _realOverlay.outlineColor = outlineColor;
49 | }
50 |
51 | - (void)setColor:(UIColor*) color {
52 | _realOverlay.fillColor = color;
53 | }
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RNNaverMapPolygonOverlayManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // RNNaverMapPolygonOverlayManager.h
3 | // reactNativeNMap
4 | //
5 | // Created by Flask on 2020/03/26.
6 | // Copyright © 2020 flask. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface RNNaverMapPolygonOverlayManager : RCTViewManager
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RNNaverMapPolygonOverlayManager.m:
--------------------------------------------------------------------------------
1 | //
2 | // RNNaverMapPolygonOverlayManager.m
3 | // reactNativeNMap
4 | //
5 | // Created by Flask on 2020/03/26.
6 | // Copyright © 2020 flask. All rights reserved.
7 | //
8 |
9 | #import "RNNaverMapPolygonOverlayManager.h"
10 | #import "RNNaverMapPolygonOverlay.h"
11 | #import
12 |
13 | #import "RCTConvert+NMFMapView.h"
14 |
15 | @implementation RNNaverMapPolygonOverlayManager
16 |
17 | RCT_EXPORT_MODULE()
18 |
19 | - (UIView *)view
20 | {
21 | RNNaverMapPolygonOverlay *overlay = [RNNaverMapPolygonOverlay new];
22 | overlay.bridge = self.bridge;
23 | return overlay;
24 | }
25 |
26 | RCT_CUSTOM_VIEW_PROPERTY(coordinates, NSDictionary, RNNaverMapPolygonOverlay) {
27 | NSDictionary *dic = [RCTConvert NSDictionary:json];
28 |
29 | // process exterior ring
30 | NSArray *exteriorRing = [RCTConvert NSArray:dic[@"exteriorRing"]];
31 | NSUInteger size = exteriorRing.count;
32 | NSMutableArray *points = [NSMutableArray arrayWithCapacity: size];
33 | for (int i=0; i *interiorRings = [RCTConvert NSArrayArray:dic[@"interiorRings"]];
40 | NSMutableArray *inRings = [[NSMutableArray alloc] init];
41 | for (NSArray *interiorRing in interiorRings) {
42 | NSMutableArray *ring = [[NSMutableArray alloc] init];
43 | for (id coord in interiorRing) {
44 | [ring addObject:[RCTConvert NMGLatLng:coord]];
45 | }
46 | [inRings addObject:[NMGLineString lineStringWithPoints:ring]];
47 | }
48 |
49 | // set polygon
50 | [view setPolygonWithRing:exRing interiorRings:inRings];
51 | }
52 | RCT_EXPORT_VIEW_PROPERTY(outlineWidth, CGFloat)
53 | RCT_EXPORT_VIEW_PROPERTY(color, UIColor)
54 | RCT_EXPORT_VIEW_PROPERTY(outlineColor, UIColor)
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RNNaverMapPolylineOverlay.h:
--------------------------------------------------------------------------------
1 | //
2 | // RNNaverMapPolylineOverlay.h
3 | //
4 | // Created by flask on 18/04/2019.
5 | // Copyright © 2019 flask. All rights reserved.
6 | //
7 |
8 | #import
9 | #import
10 | #import
11 |
12 | #import "RCTConvert+NMFMapView.h"
13 |
14 | @interface RNNaverMapPolylineOverlay : UIView
15 |
16 | @property (nonatomic, weak) RCTBridge *bridge;
17 | @property (nonatomic, strong) NMFPolylineOverlay *realOverlay;
18 |
19 | @property (nonatomic, assign) NSArray *coordinates;
20 | @property (nonatomic, assign) CGFloat strokeWidth;
21 | @property (nonatomic, strong) UIColor *strokeColor;
22 | @property (nonatomic, copy) RCTDirectEventBlock onClick;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RNNaverMapPolylineOverlay.m:
--------------------------------------------------------------------------------
1 | //
2 | // RNNaverMapPolylineOverlay.m
3 | //
4 | // Created by flask on 18/04/2019.
5 | // Copyright © 2019 flask. All rights reserved.
6 | //
7 | #import "RNNaverMapPolylineOverlay.h"
8 |
9 | #import
10 | #import
11 | #import
12 | #import
13 | #import
14 |
15 | #import "RCTConvert+NMFMapView.h"
16 |
17 | @implementation RNNaverMapPolylineOverlay {
18 | }
19 |
20 | - (instancetype)init
21 | {
22 | if ((self = [super init])) {
23 | _realOverlay = [NMFPolylineOverlay new];
24 |
25 | __block RNNaverMapPolylineOverlay *this = self;
26 | _realOverlay.touchHandler = ^BOOL(NMFOverlay *overlay) {
27 | if (this.onClick != nil) {
28 | this.onClick(@{});
29 | return YES;
30 | }
31 | return NO;
32 | };
33 | }
34 | return self;
35 | }
36 |
37 | - (void)setCoordinates:(NSArray*) coordinates {
38 | _realOverlay.line = [NMGLineString lineStringWithPoints:coordinates];
39 | }
40 |
41 | - (void)setStrokeWidth:(CGFloat) strokeWidth {
42 | _realOverlay.width = strokeWidth;
43 | }
44 |
45 | - (void)setStrokeColor:(UIColor*) strokeColor {
46 | _realOverlay.color = strokeColor;
47 | }
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RNNaverMapPolylineOverlayManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // RNNaverMapPolylineOverlayManager.h
3 | //
4 | // Created by flask on 19/04/2019.
5 | // Copyright © 2019 flask. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | @interface RNNaverMapPolylineOverlayManager : RCTViewManager
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RNNaverMapPolylineOverlayManager.m:
--------------------------------------------------------------------------------
1 | //
2 | // RNNaverMapPolylineOverlayManager.m
3 | //
4 | // Created by flask on 19/04/2019.
5 | // Copyright © 2019 flask. All rights reserved.
6 | //
7 |
8 | #import "RNNaverMapPolylineOverlayManager.h"
9 | #import "RNNaverMapPolylineOverlay.h"
10 | #import
11 |
12 | #import "RCTConvert+NMFMapView.h"
13 |
14 | @implementation RNNaverMapPolylineOverlayManager
15 |
16 | RCT_EXPORT_MODULE()
17 |
18 | - (UIView *)view
19 | {
20 | RNNaverMapPolylineOverlay *overlay = [RNNaverMapPolylineOverlay new];
21 | overlay.bridge = self.bridge;
22 | return overlay;
23 | }
24 |
25 | RCT_CUSTOM_VIEW_PROPERTY(coordinates, NSArray, RNNaverMapPolylineOverlay) {
26 | NSArray *inputArray = [RCTConvert NSArray:json];
27 | NSUInteger size = inputArray.count;
28 | NSMutableArray *points = [NSMutableArray arrayWithCapacity: size];
29 | for (int i=0; i
9 | #import
10 | #import
11 |
12 | #import
13 | #import
14 | #import
15 | #import
16 |
17 | #import "RCTConvert+NMFMapView.h"
18 |
19 | @interface RNNaverMapView : NMFNaverMapView
20 |
21 | @property (nonatomic, weak) RCTBridge *bridge;
22 | @property (nonatomic, copy) RCTDirectEventBlock onInitialized;
23 | @property (nonatomic, copy) RCTDirectEventBlock onCameraChange;
24 | @property (nonatomic, copy) RCTDirectEventBlock onTouch;
25 | @property (nonatomic, copy) RCTDirectEventBlock onMapClick;
26 |
27 | @property (nonatomic, assign) BOOL showsCompass;
28 | @property (nonatomic, assign) BOOL zoomEnabled;
29 | @property (nonatomic, assign) BOOL showsMyLocationButton;
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/ios/reactNativeNMap/RNNaverMapView.m:
--------------------------------------------------------------------------------
1 | //
2 | // RNNaverMapView.m
3 | //
4 | // Created by flask on 18/04/2019.
5 | // Copyright © 2019 flask. All rights reserved.
6 | //
7 |
8 | #import "RNNaverMapView.h"
9 | #import
10 | #import
11 | #import
12 | #import
13 |
14 | #import
15 | #import
16 | #import
17 |
18 | #import "RCTConvert+NMFMapView.h"
19 | #import "RNNaverMapMarker.h"
20 | #import "RNNaverMapPolylineOverlay.h"
21 | #import "RNNaverMapPathOverlay.h"
22 | #import "RNNaverMapCircleOverlay.h"
23 | #import "RNNaverMapPolygonOverlay.h"
24 |
25 | @interface RNNaverMapView()
26 | @end
27 |
28 | @implementation RNNaverMapView
29 | {
30 | NSMutableArray *_reactSubviews;
31 | }
32 |
33 | - (nonnull instancetype)initWithFrame:(CGRect)frame
34 | {
35 | if ((self = [super initWithFrame:frame])) {
36 | _reactSubviews = [NSMutableArray new];
37 | }
38 | return self;
39 | }
40 |
41 | - (void)insertReactSubview:(id)subview atIndex:(NSInteger)atIndex {
42 | // Our desired API is to pass up markers/overlays as children to the mapview component.
43 | // This is where we intercept them and do the appropriate underlying mapview action.
44 | if ([subview isKindOfClass:[RNNaverMapMarker class]]) {
45 | RNNaverMapMarker *marker = (RNNaverMapMarker*)subview;
46 | marker.realMarker.mapView = self.mapView;
47 | } else if ([subview isKindOfClass:[RNNaverMapPolylineOverlay class]]) {
48 | RNNaverMapPolylineOverlay *overlay = (RNNaverMapPolylineOverlay*)subview;
49 | overlay.realOverlay.mapView = self.mapView;
50 | } else if ([subview isKindOfClass:[RNNaverMapPathOverlay class]]) {
51 | RNNaverMapPathOverlay *overlay = (RNNaverMapPathOverlay*)subview;
52 | overlay.realOverlay.mapView = self.mapView;
53 | } else if ([subview isKindOfClass:[RNNaverMapCircleOverlay class]]) {
54 | RNNaverMapCircleOverlay *overlay = (RNNaverMapCircleOverlay*)subview;
55 | overlay.realOverlay.mapView = self.mapView;
56 | } else if ([subview isKindOfClass:[RNNaverMapPolygonOverlay class]]) {
57 | RNNaverMapPolygonOverlay *overlay = (RNNaverMapPolygonOverlay*)subview;
58 | overlay.realOverlay.mapView = self.mapView;
59 | } else {
60 | NSArray> *childSubviews = [subview reactSubviews];
61 | for (int i = 0; i < childSubviews.count; i++) {
62 | [self insertReactSubview:(UIView *)childSubviews[i] atIndex:atIndex];
63 | }
64 | }
65 | [_reactSubviews insertObject:(UIView *)subview atIndex:(NSUInteger) atIndex];
66 | }
67 |
68 | - (void)removeReactSubview:(id)subview {
69 | // similarly, when the children are being removed we have to do the appropriate
70 | // underlying mapview action here.
71 | if ([subview isKindOfClass:[RNNaverMapMarker class]]) {
72 | RNNaverMapMarker *marker = (RNNaverMapMarker*)subview;
73 | marker.realMarker.mapView = nil;
74 | } else if ([subview isKindOfClass:[RNNaverMapPolylineOverlay class]]) {
75 | RNNaverMapPolylineOverlay *overlay = (RNNaverMapPolylineOverlay*)subview;
76 | overlay.realOverlay.mapView = nil;
77 | } else if ([subview isKindOfClass:[RNNaverMapPathOverlay class]]) {
78 | RNNaverMapPathOverlay *overlay = (RNNaverMapPathOverlay*)subview;
79 | overlay.realOverlay.mapView = nil;
80 | } else if ([subview isKindOfClass:[RNNaverMapCircleOverlay class]]) {
81 | RNNaverMapCircleOverlay *overlay = (RNNaverMapCircleOverlay*)subview;
82 | overlay.realOverlay.mapView = nil;
83 | } else if ([subview isKindOfClass:[RNNaverMapPolygonOverlay class]]) {
84 | RNNaverMapPolygonOverlay *overlay = (RNNaverMapPolygonOverlay*)subview;
85 | overlay.realOverlay.mapView = nil;
86 | } else {
87 | NSArray> *childSubviews = [subview reactSubviews];
88 | for (int i = 0; i < childSubviews.count; i++) {
89 | [self removeReactSubview:(UIView *)childSubviews[i]];
90 | }
91 | }
92 | [_reactSubviews removeObject:(UIView *)subview];
93 | }
94 |
95 | - (NSArray> *)reactSubviews {
96 | return _reactSubviews;
97 | }
98 |
99 | - (void)mapViewIdle:(nonnull NMFMapView *)mapView {
100 | if (((RNNaverMapView*)self).onCameraChange != nil)
101 | ((RNNaverMapView*)self).onCameraChange(@{
102 | @"latitude" : @(mapView.cameraPosition.target.lat),
103 | @"longitude" : @(mapView.cameraPosition.target.lng),
104 | @"zoom" : @(mapView.cameraPosition.zoom),
105 | @"contentRegion" : pointsToJson(mapView.contentRegion.exteriorRing.points),
106 | @"coveringRegion": pointsToJson(mapView.coveringRegion.exteriorRing.points),
107 | });
108 | }
109 |
110 | static NSArray* pointsToJson(NSArray *points) {
111 | NSMutableArray *array = [NSMutableArray array];
112 | for (int i = 0; i < points.count; i++)
113 | [array addObject: toJson(points[i])];
114 | return array;
115 | }
116 |
117 | static NSDictionary* toJson(NMGLatLng * _Nonnull latlng) {
118 | return @{
119 | @"latitude" : @(latlng.lat),
120 | @"longitude": @(latlng.lng),
121 | };
122 | }
123 |
124 | - (void)didTapMapView:(CGPoint)point LatLng:(NMGLatLng *)latlng {
125 | if (((RNNaverMapView*)self).onMapClick != nil)
126 | ((RNNaverMapView*)self).onMapClick(@{
127 | @"x" : @(point.x),
128 | @"y" : @(point.y),
129 | @"latitude" : @(latlng.lat),
130 | @"longitude": @(latlng.lng)
131 | });
132 | }
133 |
134 | - (void)mapView:(nonnull NMFMapView *)mapView regionWillChangeAnimated:(BOOL)animated byReason:(NSInteger)reason {
135 | if (((RNNaverMapView*)self).onTouch != nil)
136 | ((RNNaverMapView*)self).onTouch(@{
137 | @"animated": @(animated),
138 | @"reason": @(reason)
139 | });
140 | }
141 |
142 |
143 |
144 | @end
145 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-nmap",
3 | "version": "0.0.67",
4 | "description": "react-native bridge for naver map",
5 | "main": "index.js",
6 | "author": "ZeroCho",
7 | "license": "MIT",
8 | "homepage": "https://github.com/zerocho/react-native-naver-map",
9 | "scripts": {
10 | "start": "react-native start",
11 | "test": "jest",
12 | "lint": "eslint .",
13 | "build:examplets": "tsc -p ./tsconfig.json --outDir ./example/map/",
14 | "build": "tsc -p ./tsconfig.json",
15 | "deploy": "npm version patch; npm run build; npm publish"
16 | },
17 | "repository": {
18 | "type": "git",
19 | "url": "https://github.com/zerocho/react-native-naver-map"
20 | },
21 | "keywords": [
22 | "react-native",
23 | "navermap"
24 | ],
25 | "peerDependencies": {
26 | "react": ">=17",
27 | "react-native": ">=0.66"
28 | },
29 | "devDependencies": {
30 | "@babel/core": "^7.22.11",
31 | "@babel/runtime": "^7.22.11",
32 | "@react-native-community/eslint-config": "^3.2.0",
33 | "babel-jest": "^29.6.4",
34 | "eslint": "^8.48.0",
35 | "jest": "^29.6.4",
36 | "metro-react-native-babel-preset": "^0.77.0",
37 | "typescript": "^5"
38 | },
39 | "jest": {
40 | "preset": "react-native"
41 | },
42 | "files": [
43 | "*.js",
44 | "*.ts",
45 | "*.tsx",
46 | "*.json",
47 | "ios/reactNativeNMap/**",
48 | "ios/reactNativeNMap.xcodeproj/**",
49 | "ios/Frameworks/**",
50 | "react-native-nmap.podspec",
51 | "android/**"
52 | ]
53 | }
54 |
--------------------------------------------------------------------------------
/react-native-nmap.podspec:
--------------------------------------------------------------------------------
1 | require 'json'
2 |
3 | package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4 |
5 | Pod::Spec.new do |s|
6 | s.name = "react-native-nmap"
7 | s.version = package['version']
8 | s.summary = "React Native Naver Mapview component for iOS + Android"
9 |
10 | s.authors = { "author" => "zerohch0@gmail.com" }
11 | s.homepage = "https://github.com/zerocho/react-native-naver-map"
12 | s.license = package['license']
13 | s.platform = :ios, "9.0"
14 |
15 | s.source = { :git => "https://github.com/zerocho/react-native-naver-map.git", :tag => "#{s.version}" }
16 | s.source_files = "ios/**/*.{h,m}"
17 |
18 | s.static_framework = true
19 | s.dependency 'React'
20 | s.dependency 'NMapsMap'
21 |
22 | end
23 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "declaration": true,
4 | "allowSyntheticDefaultImports": true,
5 | "experimentalDecorators": true,
6 | "resolveJsonModule": true,
7 | "moduleResolution": "node",
8 | "jsx": "react",
9 | "target": "es6",
10 | "lib": ["esnext"]
11 | },
12 | "include": [
13 | "*.ts",
14 | "*.tsx"
15 | ],
16 | "exclude": [
17 | "node_modules"
18 | ]
19 | }
--------------------------------------------------------------------------------