Skip to content

Commit

Permalink
Merge pull request #40 from mym0404/global-z-index-prop
Browse files Browse the repository at this point in the history
Global Z Index Prop
  • Loading branch information
mym0404 authored May 10, 2024
2 parents cb34306 + 6ca975c commit c9ea59f
Show file tree
Hide file tree
Showing 57 changed files with 312 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.facebook.react.uimanager.annotations.ReactProp
import com.mjstudio.reactnativenavermap.RNCNaverMapArrowheadPathManagerSpec
import com.mjstudio.reactnativenavermap.event.NaverMapOverlayTapEvent
import com.mjstudio.reactnativenavermap.util.getLatLng
import com.mjstudio.reactnativenavermap.util.isValidNumber
import com.mjstudio.reactnativenavermap.util.px
import com.mjstudio.reactnativenavermap.util.registerDirectEvent
import com.naver.maps.map.overlay.ArrowheadPathOverlay
Expand Down Expand Up @@ -41,6 +42,16 @@ class RNCNaverMapArrowheadPathManager : RNCNaverMapArrowheadPathManagerSpec<RNCN
it.zIndex = value
}

@ReactProp(name = "globalZIndexValue")
override fun setGlobalZIndexValue(
view: RNCNaverMapArrowheadPath?,
value: Int,
) = view.withOverlay {
if (isValidNumber(value)) {
it.globalZIndex = value
}
}

@ReactProp(name = "isHidden")
override fun setIsHidden(
view: RNCNaverMapArrowheadPath?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.facebook.react.uimanager.annotations.ReactProp
import com.mjstudio.reactnativenavermap.RNCNaverMapCircleManagerSpec
import com.mjstudio.reactnativenavermap.event.NaverMapOverlayTapEvent
import com.mjstudio.reactnativenavermap.util.getLatLng
import com.mjstudio.reactnativenavermap.util.isValidNumber
import com.mjstudio.reactnativenavermap.util.px
import com.mjstudio.reactnativenavermap.util.registerDirectEvent
import com.naver.maps.map.overlay.CircleOverlay
Expand Down Expand Up @@ -51,6 +52,16 @@ class RNCNaverMapCircleManager : RNCNaverMapCircleManagerSpec<RNCNaverMapCircle>
it.zIndex = value
}

@ReactProp(name = "globalZIndexValue")
override fun setGlobalZIndexValue(
view: RNCNaverMapCircle?,
value: Int,
) = view.withOverlay {
if (isValidNumber(value)) {
it.globalZIndex = value
}
}

@ReactProp(name = "isHidden")
override fun setIsHidden(
view: RNCNaverMapCircle?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.facebook.react.uimanager.annotations.ReactProp
import com.mjstudio.reactnativenavermap.RNCNaverMapGroundManagerSpec
import com.mjstudio.reactnativenavermap.event.NaverMapOverlayTapEvent
import com.mjstudio.reactnativenavermap.util.getLatLngBoundsOrNull
import com.mjstudio.reactnativenavermap.util.isValidNumber
import com.mjstudio.reactnativenavermap.util.registerDirectEvent
import com.naver.maps.map.overlay.GroundOverlay

Expand Down Expand Up @@ -40,6 +41,16 @@ class RNCNaverMapGroundManager : RNCNaverMapGroundManagerSpec<RNCNaverMapGround>
it.zIndex = value
}

@ReactProp(name = "globalZIndexValue")
override fun setGlobalZIndexValue(
view: RNCNaverMapGround?,
value: Int,
) = view.withOverlay {
if (isValidNumber(value)) {
it.globalZIndex = value
}
}

@ReactProp(name = "isHidden")
override fun setIsHidden(
view: RNCNaverMapGround?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ class RNCNaverMapMarkerManager : RNCNaverMapMarkerManagerSpec<RNCNaverMapMarker>
it.zIndex = value
}

@ReactProp(name = "globalZIndexValue")
override fun setGlobalZIndexValue(
view: RNCNaverMapMarker?,
value: Int,
) = view.withOverlay {
if (isValidNumber(value)) {
it.globalZIndex = value
}
}

@ReactProp(name = "isHidden")
override fun setIsHidden(
view: RNCNaverMapMarker?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.facebook.react.uimanager.annotations.ReactProp
import com.mjstudio.reactnativenavermap.RNCNaverMapPathManagerSpec
import com.mjstudio.reactnativenavermap.event.NaverMapOverlayTapEvent
import com.mjstudio.reactnativenavermap.util.getLatLng
import com.mjstudio.reactnativenavermap.util.isValidNumber
import com.mjstudio.reactnativenavermap.util.px
import com.mjstudio.reactnativenavermap.util.registerDirectEvent
import com.naver.maps.map.overlay.PathOverlay
Expand Down Expand Up @@ -42,6 +43,16 @@ class RNCNaverMapPathManager : RNCNaverMapPathManagerSpec<RNCNaverMapPath>() {
it.zIndex = value
}

@ReactProp(name = "globalZIndexValue")
override fun setGlobalZIndexValue(
view: RNCNaverMapPath?,
value: Int,
) = view.withOverlay {
if (isValidNumber(value)) {
it.globalZIndex = value
}
}

@ReactProp(name = "isHidden")
override fun setIsHidden(
view: RNCNaverMapPath?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.facebook.react.uimanager.annotations.ReactProp
import com.mjstudio.reactnativenavermap.RNCNaverMapPolygonManagerSpec
import com.mjstudio.reactnativenavermap.event.NaverMapOverlayTapEvent
import com.mjstudio.reactnativenavermap.util.getLatLng
import com.mjstudio.reactnativenavermap.util.isValidNumber
import com.mjstudio.reactnativenavermap.util.px
import com.mjstudio.reactnativenavermap.util.registerDirectEvent
import com.naver.maps.map.overlay.PolygonOverlay
Expand Down Expand Up @@ -41,6 +42,16 @@ class RNCNaverMapPolygonManager : RNCNaverMapPolygonManagerSpec<RNCNaverMapPolyg
it.zIndex = value
}

@ReactProp(name = "globalZIndexValue")
override fun setGlobalZIndexValue(
view: RNCNaverMapPolygon?,
value: Int,
) = view.withOverlay {
if (isValidNumber(value)) {
it.globalZIndex = value
}
}

@ReactProp(name = "isHidden")
override fun setIsHidden(
view: RNCNaverMapPolygon?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.facebook.react.uimanager.annotations.ReactProp
import com.mjstudio.reactnativenavermap.RNCNaverMapPolylineManagerSpec
import com.mjstudio.reactnativenavermap.event.NaverMapOverlayTapEvent
import com.mjstudio.reactnativenavermap.util.getLatLng
import com.mjstudio.reactnativenavermap.util.isValidNumber
import com.mjstudio.reactnativenavermap.util.px
import com.mjstudio.reactnativenavermap.util.registerDirectEvent
import com.naver.maps.map.overlay.PolylineOverlay
Expand Down Expand Up @@ -41,6 +42,16 @@ class RNCNaverMapPolylineManager : RNCNaverMapPolylineManagerSpec<RNCNaverMapPol
it.zIndex = value
}

@ReactProp(name = "globalZIndexValue")
override fun setGlobalZIndexValue(
view: RNCNaverMapPolyline?,
value: Int,
) = view.withOverlay {
if (isValidNumber(value)) {
it.globalZIndex = value
}
}

@ReactProp(name = "isHidden")
override fun setIsHidden(
view: RNCNaverMapPolyline?,
Expand Down
5 changes: 5 additions & 0 deletions android/src/oldarch/RNCNaverMapArrowheadPathManagerSpec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ internal interface RNCNaverMapArrowheadPathManagerInterface<T : View?> {
value: Int,
)

fun setGlobalZIndexValue(
view: T,
value: Int,
)

fun setIsHidden(
view: T,
value: Boolean,
Expand Down
5 changes: 5 additions & 0 deletions android/src/oldarch/RNCNaverMapCircleManagerSpec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ internal interface RNCNaverMapCircleManagerInterface<T : View?> {
value: Int,
)

fun setGlobalZIndexValue(
view: T,
value: Int,
)

fun setIsHidden(
view: T,
value: Boolean,
Expand Down
5 changes: 5 additions & 0 deletions android/src/oldarch/RNCNaverMapGroundManagerSpec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ internal interface RNCNaverMapGroundManagerInterface<T : View?> {
value: Int,
)

fun setGlobalZIndexValue(
view: T,
value: Int,
)

fun setIsHidden(
view: T,
value: Boolean,
Expand Down
5 changes: 5 additions & 0 deletions android/src/oldarch/RNCNaverMapMarkerManagerSpec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ internal interface RNCNaverMapMarkerManagerInterface<T : ViewGroup?> {
value: Int,
)

fun setGlobalZIndexValue(
view: T,
value: Int,
)

fun setIsHidden(
view: T,
value: Boolean,
Expand Down
5 changes: 5 additions & 0 deletions android/src/oldarch/RNCNaverMapPathManagerSpec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ internal interface RNCNaverMapPathManagerInterface<T : View?> {
value: Int,
)

fun setGlobalZIndexValue(
view: T,
value: Int,
)

fun setIsHidden(
view: T,
value: Boolean,
Expand Down
5 changes: 5 additions & 0 deletions android/src/oldarch/RNCNaverMapPolygonManagerSpec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ internal interface RNCNaverMapPolygonManagerInterface<T : View?> {
value: Int,
)

fun setGlobalZIndexValue(
view: T,
value: Int,
)

fun setIsHidden(
view: T,
value: Boolean,
Expand Down
5 changes: 5 additions & 0 deletions android/src/oldarch/RNCNaverMapPolylineManagerSpec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ internal interface RNCNaverMapPolylineManagerInterface<T : View?> {
value: Int,
)

fun setGlobalZIndexValue(
view: T,
value: Int,
)

fun setIsHidden(
view: T,
value: Boolean,
Expand Down
4 changes: 2 additions & 2 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ PODS:
- hermes-engine/Pre-built (= 0.73.6)
- hermes-engine/Pre-built (0.73.6)
- libevent (2.1.12)
- mj-studio-react-native-naver-map (1.4.1):
- mj-studio-react-native-naver-map (1.5.4):
- glog
- hermes-engine
- NMapsMap (= 3.18.0)
Expand Down Expand Up @@ -1344,7 +1344,7 @@ SPEC CHECKSUMS:
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
hermes-engine: 9cecf9953a681df7556b8cc9c74905de8f3293c0
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
mj-studio-react-native-naver-map: c0a650b84a15238820f08991013a46d28ee03f65
mj-studio-react-native-naver-map: 655b75eaf10c7a2f13edf2753218375154f57c84
NMapsGeometry: 53c573ead66466681cf123f99f698dc8071a4b83
NMapsMap: 36dc18a1f5f315121b33fccd2398c7a702bf0fc8
RCT-Folly: 7169b2b1c44399c76a47b5deaaba715eeeb476c0
Expand Down
53 changes: 27 additions & 26 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
type Camera,
NaverMapView,
type ClusterMarkerProp,
NaverMapPathOverlay,
NaverMapGroundOverlay,
type Region,
NaverMapCircleOverlay,
} from '@mj-studio/react-native-naver-map';
import { Toggle, Btn, Range } from './component/components';
import {
Expand Down Expand Up @@ -215,15 +215,16 @@ export default function App() {
{/* image={{ httpUri: 'https://picsum.photos/1000/1201' }}*/}
{/*/>*/}

{/*<NaverMapCircleOverlay*/}
{/* latitude={33.17827398}*/}
{/* longitude={126.349895729}*/}
{/* radius={50000}*/}
{/* color={'#f2f1'}*/}
{/* outlineColor={'#aaa'}*/}
{/* outlineWidth={2}*/}
{/* onTap={() => console.log('hi')}*/}
{/*/>*/}
<NaverMapCircleOverlay
latitude={33.17827398}
longitude={126.349895729}
radius={50000}
color={'#f2f'}
outlineColor={'#aaa'}
outlineWidth={2}
globalZIndex={1}
onTap={() => console.log('hi')}
/>
{/*<NaverMapPolygonOverlay*/}
{/* outlineWidth={5}*/}
{/* outlineColor={'#f2f2'}*/}
Expand Down Expand Up @@ -260,22 +261,22 @@ export default function App() {
{/* passedColor={'black'}*/}
{/* outlineWidth={1}*/}
{/*/>*/}
<NaverMapPathOverlay
coords={[
{ longitude: 126.93240597362552, latitude: 32.433509943138404 },
{ longitude: 126.93474226289788, latitude: 32.6383463419792 },
{ longitude: 127.07281803100506, latitude: 32.57085962943823 },
{ longitude: 126.96403036772739, latitude: 32.52862726684933 },
]}
width={8}
color={'white'}
progress={0.5}
passedColor={'black'}
outlineWidth={1}
zIndex={1}
patternInterval={100}
patternImage={{ symbol: 'blue' }}
/>
{/*<NaverMapPathOverlay*/}
{/* coords={[*/}
{/* { longitude: 126.93240597362552, latitude: 32.433509943138404 },*/}
{/* { longitude: 126.93474226289788, latitude: 32.6383463419792 },*/}
{/* { longitude: 127.07281803100506, latitude: 32.57085962943823 },*/}
{/* { longitude: 126.96403036772739, latitude: 32.52862726684933 },*/}
{/* ]}*/}
{/* width={8}*/}
{/* color={'white'}*/}
{/* progress={0.5}*/}
{/* passedColor={'black'}*/}
{/* outlineWidth={1}*/}
{/* zIndex={1}*/}
{/* patternInterval={100}*/}
{/* patternImage={{ symbol: 'blue' }}*/}
{/*/>*/}
{/*<NaverMapArrowheadPathOverlay*/}
{/* coords={[*/}
{/* { longitude: 126.93240597362552, latitude: 32.433509943138404 },*/}
Expand Down
20 changes: 20 additions & 0 deletions ios/Module/RNCNaverMapUtil.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// RNCNaverMapUtil.h
// mj-studio-react-native-naver-map
//
// Created by mj on 5/10/24.
//

#import <NMapsMap/NMapsMap.h>

#ifdef RCT_NEW_ARCH_ENABLED
#import "RNCNaverMapSpec.h"

@interface RNCNaverMapUtil : NSObject <NativeRNCNaverMapUtilSpec>
#else
#import <React/RCTBridgeModule.h>

@interface RNCNaverMapUtil : NSObject <RCTBridgeModule>
#endif

@end
22 changes: 22 additions & 0 deletions ios/Module/RNCNaverMapUtil.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// RNCNaverMapUtil.m
// mj-studio-react-native-naver-map
//
// Created by mj on 5/10/24.
//

#import "RNCNaverMapUtil.h"
#import <Foundation/Foundation.h>

@implementation RNCNaverMapUtil

RCT_EXPORT_MODULE()

#ifdef RCT_NEW_ARCH_ENABLED
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
(const facebook::react::ObjCTurboModule::InitParams&)params {
return std::make_shared<facebook::react::NativeRNCNaverMapUtilSpecJSI>(params);
}
#endif

@end
1 change: 1 addition & 0 deletions ios/Overlay/ArrowheadPath/RNCNaverMapArrowheadPath.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
@property(nonatomic, strong) NMFArrowheadPath* inner;

@property(nonatomic, assign) NSInteger zIndexValue;
@property(nonatomic, assign) NSInteger globalZIndexValue;
@property(nonatomic, assign) BOOL isHidden;
@property(nonatomic, assign) double minZoom;
@property(nonatomic, assign) double maxZoom;
Expand Down
Loading

0 comments on commit c9ea59f

Please sign in to comment.