From 2a9dd2426566dfd92a31f1f9264feb341b12f463 Mon Sep 17 00:00:00 2001 From: scorchedrice Date: Tue, 29 Jul 2025 15:49:24 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20vercel=20=EB=B0=B0=ED=8F=AC=20githu?= =?UTF-8?q?b=20action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..003a172 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,31 @@ +name: git push into another repo to deploy to vercel + +on: + push: + branches: [main] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + container: pandoc/latex + steps: + - uses: actions/checkout@v2 + - name: Install mustache (to update the date) + run: apk add ruby && gem install mustache + - name: creates output + run: sh ./build.sh + - name: Pushes to another repository + id: push_directory + uses: cpina/github-action-push-to-another-repository@main + env: + API_TOKEN_GITHUB: ${{ secrets.AUTO_ACTIONS }} + with: + source-directory: 'output' + destination-github-username: scorchedrice + destination-repository-name: mycode + user-email: ${{ secrets.EMAIL }} + commit-message: ${{ github.event.commits[0].message }} + target-branch: main + - name: Test get variable exported by push-to-another-repository + run: echo $DESTINATION_CLONED_DIRECTORY \ No newline at end of file From 50d62c75ae499e3825120c0c9ea00b9ea57367bd Mon Sep 17 00:00:00 2001 From: scorchedrice Date: Tue, 29 Jul 2025 15:58:58 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20web,=20native=20=ED=99=98=EA=B2=BD?= =?UTF-8?q?=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EB=B6=84=EB=A6=AC=20?= =?UTF-8?q?(=EB=84=A4=EC=9D=B4=EB=B2=84=EC=A7=80=EB=8F=84)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.config.js | 1 + app/(tabs)/detail/[id].tsx | 31 ++---------------- components/map/NaverMap.native.tsx | 35 ++++++++++++++++++++ components/map/NaverMap.tsx | 15 +++++++++ components/map/NaverMap.web.tsx | 52 ++++++++++++++++++++++++++++++ 5 files changed, 106 insertions(+), 28 deletions(-) create mode 100644 components/map/NaverMap.native.tsx create mode 100644 components/map/NaverMap.tsx create mode 100644 components/map/NaverMap.web.tsx diff --git a/app.config.js b/app.config.js index d88c7ab..e1d93c3 100644 --- a/app.config.js +++ b/app.config.js @@ -106,6 +106,7 @@ export default { storybookEnabled: process.env.STORYBOOK_ENABLED, kakaoNativeAppKey: process.env.MYCODE_KAKAO_NATIVE_APP_KEY, BACKEND_URL: process.env.MYCODE_BACKEND_URL, + NAVER_MAP_CLIENT_ID: process.env.NAVER_MAP_CLIENT_ID, eas: { projectId: process.env.MYCODE_EAS_PROJECT_ID, }, diff --git a/app/(tabs)/detail/[id].tsx b/app/(tabs)/detail/[id].tsx index 8c6fd7f..f7254af 100644 --- a/app/(tabs)/detail/[id].tsx +++ b/app/(tabs)/detail/[id].tsx @@ -1,9 +1,5 @@ import { useCallback, useRef, useState } from "react"; -import { - NaverMapMarkerOverlay, - NaverMapView, -} from "@mj-studio/react-native-naver-map"; import { shareFeedTemplate } from "@react-native-kakao/share"; import * as Clipboard from "expo-clipboard"; import { useFocusEffect, useRouter } from "expo-router"; @@ -22,9 +18,9 @@ import BackArrow from "@/components/icons/BackArrow"; import CopyIcon from "@/components/icons/CopyIcon"; import HeartOutlineIcon from "@/components/icons/HeartOutlineIcon"; import LocationIcon from "@/components/icons/LocationIcon"; -import LocationMarkerIcon from "@/components/icons/LocationMarkerIcon"; import LocationPinIcon from "@/components/icons/LocationPinIcon"; import ShareOutlineIcon from "@/components/icons/ShareOutlineIcon"; +import NaverMap from "@/components/map/NaverMap"; const SCREEN_HEIGHT = Dimensions.get("window").height; const IMAGE_HEIGHT = SCREEN_HEIGHT * 0.4; @@ -325,29 +321,8 @@ export default function DetailScreen() { 위치 - - - - - - - + {/*네이버지도 컴포넌트*/} + diff --git a/components/map/NaverMap.native.tsx b/components/map/NaverMap.native.tsx new file mode 100644 index 0000000..1bdd11f --- /dev/null +++ b/components/map/NaverMap.native.tsx @@ -0,0 +1,35 @@ +import { + NaverMapMarkerOverlay, + NaverMapView, +} from "@mj-studio/react-native-naver-map"; +import { View } from "react-native"; + +import LocationMarkerIcon from "@/components/icons/LocationMarkerIcon"; + +export default function NaverMapNative({ mapKey }: { mapKey: number }) { + return ( + + + + + + + + ); +} diff --git a/components/map/NaverMap.tsx b/components/map/NaverMap.tsx new file mode 100644 index 0000000..6d5556d --- /dev/null +++ b/components/map/NaverMap.tsx @@ -0,0 +1,15 @@ +import { JSX } from "react"; + +import { Platform } from "react-native"; + +// 타입 명시가 있으면 더 안전 +type NaverMapComponent = (props: { mapKey: number }) => JSX.Element; + +const loader = Platform.select<() => NaverMapComponent>({ + native: () => require("./NaverMap.native").default, + web: () => require("./NaverMap.web").default, +}); + +const NaverMap = loader ? loader() : () => null; // 함수 그대로 export + +export default NaverMap; diff --git a/components/map/NaverMap.web.tsx b/components/map/NaverMap.web.tsx new file mode 100644 index 0000000..46594e2 --- /dev/null +++ b/components/map/NaverMap.web.tsx @@ -0,0 +1,52 @@ +import { useEffect } from "react"; + +import Constants from "expo-constants"; +import { View } from "react-native"; + +declare global { + interface Window { + naver: any; + } +} + +export default function NaverMapWeb({ mapKey }: { mapKey: number }) { + const sdkUrl = `https://oapi.map.naver.com/openapi/v3/maps.js?ncpClientId=${Constants.expoConfig?.extra?.NAVER_MAP_CLIENT_ID}`; + useEffect(() => { + const existingScript = document.querySelector(`script[src="${sdkUrl}"]`); + if (existingScript) { + if (window.naver?.maps) { + renderMap(); + } + return; + } + + const script = document.createElement("script"); + script.src = sdkUrl; + script.async = true; + script.onload = () => { + if (window.naver?.maps) { + renderMap(); + } + }; + document.head.appendChild(script); + }, [mapKey, sdkUrl]); + const renderMap = () => { + const map = new window.naver.maps.Map("map", { + center: new window.naver.maps.LatLng(37.5665, 126.978), + zoom: 15, + }); + + new window.naver.maps.Marker({ + position: new window.naver.maps.LatLng(37.5665, 126.978), + map, + }); + }; + return ( + + + + ); +}