1
- import { Container , NaverMap , useNavermaps } from 'react-naver-maps' ;
1
+ import { Container , Marker , NaverMap , useNavermaps } from 'react-naver-maps' ;
2
2
import { checkIsAndroid , checkIsIOS , checkIsWebView } from '@boolti/bridge' ;
3
3
4
4
import Styled from './PreviewMap.styles' ;
5
5
import { CurvedArrowRightIcon } from '@boolti/icon' ;
6
6
import { useConfirm } from '../../hooks' ;
7
7
8
+ import markerImageUrl from '../../assets/images/marker.png'
9
+
10
+
8
11
interface Props {
9
12
latitude : number ;
10
13
longitude : number ;
11
14
name : string ;
15
+ isAppWebview : boolean ;
12
16
}
13
17
14
18
const CONFIRM_LOCAL_STORAGE_KEY = 'BOOLTI_PREVIEW_MAP_OPEN_NAVER_MAP' ;
15
19
16
- const PreviewMap = ( { latitude, longitude, name } : Props ) => {
17
- const navermaps = useNavermaps ( ) ;
20
+ const PreviewMap = ( { latitude, longitude, name, isAppWebview } : Props ) => {
18
21
const confirm = useConfirm ( ) ;
22
+ const navermaps = useNavermaps ( ) ;
19
23
20
24
const openNaverMaps = async ( ) => {
21
25
if ( ! localStorage . getItem ( CONFIRM_LOCAL_STORAGE_KEY ) ) {
22
- const isConfirm = await confirm (
23
- < Styled . ConfirmText >
24
- 길찾기를 위해{ '\n' } 네이버 지도앱으로 이동합니다.
25
- < Styled . ConfirmDescription > * 이 안내는 한 번만 표시됩니다.</ Styled . ConfirmDescription >
26
- </ Styled . ConfirmText > ,
27
- {
28
- cancel : '취소하기' ,
29
- confirm : '이동하기' ,
30
- } ,
31
- ) ;
26
+ if ( ! isAppWebview ) {
27
+ const isConfirm = await confirm (
28
+ < Styled . ConfirmText >
29
+ 길찾기를 위해{ '\n' } 네이버 지도로 이동합니다.
30
+ < Styled . ConfirmDescription > * 이 안내는 한 번만 표시됩니다.</ Styled . ConfirmDescription >
31
+ </ Styled . ConfirmText > ,
32
+ {
33
+ cancel : '취소하기' ,
34
+ confirm : '이동하기' ,
35
+ } ,
36
+ ) ;
32
37
33
- if ( ! isConfirm ) {
34
- return ;
38
+ if ( ! isConfirm ) {
39
+ return ;
40
+ }
35
41
}
36
42
37
43
localStorage . setItem ( CONFIRM_LOCAL_STORAGE_KEY , new Date ( ) . valueOf ( ) . toString ( ) ) ;
@@ -69,6 +75,7 @@ const PreviewMap = ({ latitude, longitude, name }: Props) => {
69
75
zIndex : 0 ,
70
76
borderRadius : 8 ,
71
77
} }
78
+ onClick = { openNaverMaps }
72
79
>
73
80
< NaverMap
74
81
draggable = { false }
@@ -85,8 +92,10 @@ const PreviewMap = ({ latitude, longitude, name }: Props) => {
85
92
mapTypeControl = { false }
86
93
zoom = { 18 }
87
94
defaultCenter = { new navermaps . LatLng ( latitude , longitude ) }
88
- />
89
- < Styled . Button onClick = { openNaverMaps } >
95
+ >
96
+ < Marker position = { new navermaps . LatLng ( latitude , longitude ) } icon = { { url : markerImageUrl , size : { width : 48 , height : 61 } } } />
97
+ </ NaverMap >
98
+ < Styled . Button >
90
99
< CurvedArrowRightIcon />
91
100
</ Styled . Button >
92
101
</ Container >
0 commit comments