Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 현재 위치 기반 지도 개발 #83

Merged
merged 17 commits into from
Nov 19, 2024
Merged

feat: 현재 위치 기반 지도 개발 #83

merged 17 commits into from
Nov 19, 2024

Conversation

itslitulinchpin2
Copy link
Contributor

#️⃣연관된 이슈

resolve: #35

📝작업 내용

  • react-native-permissions을 통해 위치 허용 여부를 결정받습니다.
  • react-native-community/geolocation 을 통해 현재 위치값을 받아옵니다.
  • react-native-naver-map 이용해서 지도를 띄웁니다.
  • feed페이지에서는 내 위치 기반 거리순으로 가게를 조회할 수 있습니다.
  • .env에 키값들 추가하였습니다.
  • MarketType에 위도, 경도가 추가되었습니다.
  • 버튼 클릭시 map화면으로 이동
  • map화면으로 넘어갈때는 api콜을 하지 않고, feed에서 받아온 데이터를 정제하여 params로 넘겨 Marker로 표시했습니다.
  • 현재 위치는 초록색 마커, 가게들은 파란색 마커로 표시
  • 지도상에서 마커 클릭시 해당 가게로 네비게이션 기능 추가하였습니다.

간단히 로직 설명

  • 위치 추적: Geolocation.watchPosition을 사용하여 실시간으로 위치 변화를 추적. (10m 이상 변동시 위치 변경으로 인식)
  • 위치 변경 시 상태 업데이트: 위치가 변경되면 location 상태가 갱신.
  • API 호출 및 가게 정보 업데이트: location이 변경되면 fetchData 함수가 호출되어 서버에서 새로 가게 목록을 받아옵니다.
  • 화면 업데이트: marketList 상태가 변경되면 화면에 새로운 가게 목록이 반영됩니다.

스크린샷 (선택)

image image

💬리뷰 요구사항(선택)

  • 에뮬레이터에서는 실시간 gps 작동이 되지 않아 실제 모바일로 확인이 필요합니다.
  • 위치 허용 하지 않아도 서버에서 디폴트 위치 기반으로 가게를 응답값으로 주는 것으로 처리했습니다.
  • naver api 문서를 보다 보니 추후 배포시에 저희앱 명을 clientApp에서 더 구체적이게 변경해야할 것 같습니다.
    (https://guide.ncloud-docs.com/docs/ko/naveropenapiv3-application)

@itslitulinchpin2 itslitulinchpin2 self-assigned this Nov 18, 2024
@itslitulinchpin2 itslitulinchpin2 requested review from 99mini and l-lyun and removed request for 99mini November 18, 2024 02:53
Copy link
Contributor

@99mini 99mini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다..! 몇몇 리뷰 남깁니다

@99mini 99mini merged commit 9eabc2f into main Nov 19, 2024
1 check passed
@99mini 99mini deleted the feature/location-map branch November 19, 2024 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(client): 사용자 위치 기반 API 개발
2 participants