Skip to content

Commit

Permalink
feat(map): ios isShowScaleBar isShowCompass
Browse files Browse the repository at this point in the history
  • Loading branch information
mym0404 committed May 5, 2024
1 parent d29ccea commit 07ad242
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/map/ios/Component/Map/RNCKakaoMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,21 @@ - (void)updateProps:(Props::Shared const&)props oldProps:(Props::Shared const&)o
if (check(p.language != n.language))
[self.map setLanguage:n.language == "en" ? @"en" : @"ko"];

if (check(p.isShowScaleBar != n.isShowScaleBar)) {
if (n.isShowScaleBar) {
[self.map showScaleBar];
} else {
[self.map hideScaleBar];
}
}
if (check(p.isShowCompass != n.isShowCompass)) {
if (n.isShowCompass) {
[self.map showCompass];
} else {
[self.map hideCompass];
}
}

[super updateProps:props oldProps:oldProps];
if (self.map && _shouldForceUpdatePropsForInitialRender) {
_shouldForceUpdatePropsForInitialRender = NO;
Expand Down
7 changes: 7 additions & 0 deletions packages/map/src/component/KakaoMapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ interface KakaoMapProps extends ViewProps {
poiClickable?: boolean;
poiScale?: 'small' | 'regular' | 'large' | 'xlarge';
language?: 'ko' | 'en';

isShowScaleBar?: boolean;
isShowCompass?: boolean;
}
interface KakaoMapRef {}

Expand All @@ -38,6 +41,8 @@ const KakaoMapView = forwardRef(
cameraMinLevel = Const.nullNumber,
cameraMaxLevel = Const.nullNumber,
cameraAnimationDuration = 0,
isShowScaleBar = true,
isShowCompass = true,
...rest
}: KakaoMapProps,
ref: ForwardedRef<KakaoMapRef>,
Expand Down Expand Up @@ -65,6 +70,8 @@ const KakaoMapView = forwardRef(
poiScale={poiScale}
language={language}
overlays={overlays}
isShowScaleBar={isShowScaleBar}
isShowCompass={isShowCompass}
{...rest}
/>
);
Expand Down
3 changes: 3 additions & 0 deletions packages/map/src/spec/RNCKakaoMapViewNativeComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ interface Props extends ViewProps {
cameraMinLevel?: Double;
cameraMaxLevel?: Double;
cameraAnimationDuration?: Double;

isShowScaleBar?: boolean;
isShowCompass?: boolean;
}

// type ComponentType = HostComponent<Props>;
Expand Down

0 comments on commit 07ad242

Please sign in to comment.