Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 14, 2025

This PR implements current location display functionality on the maps screen using expo-location for location services and TanStack Query for async data management.

Changes Made

1. Added expo-location dependency

  • Installed expo-location package to handle device location services

2. Created reusable location hook

  • Added hooks/use-location.ts with useCurrentLocation() hook
  • Integrates with TanStack Query for proper async state management
  • Handles location permissions automatically
  • Provides error handling and caching (5min fresh, 10min cache)
  • Returns typed location data with latitude, longitude, and accuracy

3. Enhanced maps screen

  • Updated maps.native.tsx to use the location hook
  • Displays current location as an orange marker with Japanese title "現在地"
  • Dynamically adjusts initial map region to center on current location when available
  • Gracefully falls back to Tokyo Tower if location is unavailable
  • Maintains all existing functionality (static markers and route polyline)

Technical Implementation

The implementation follows the existing patterns in the codebase:

  • Uses TanStack Query (already configured in app layout)
  • Follows TypeScript conventions with proper type definitions
  • Maintains platform-specific file structure (.native.tsx for mobile)
  • Passes all linting, formatting, and TypeScript checks

User Experience

When users open the maps screen:

  1. The app requests location permission if not already granted
  2. If permission is granted, the map centers on the user's current location
  3. An orange marker shows "現在地" (current location in Japanese)
  4. If permission is denied or location unavailable, the map defaults to Tokyo Tower
  5. All existing markers and route remain visible

The location data is cached efficiently to minimize battery usage and API calls.

Fixes #30.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.expo.dev
    • Triggering command: node /home/REDACTED/work/template-mobile-app/template-mobile-app/mobile-app/node_modules/.bin/expo start (dns block)
  • cdp.expo.dev
    • Triggering command: /home/REDACTED/.nvm/versions/node/v22.14.0/bin/node /home/REDACTED/work/template-mobile-app/template-mobile-app/mobile-app/node_modules/@expo/cli/build/src/utils/telemetry/clients/flushFetchDetached.js /tmp/b018677bc07f7b07a8015f29a62bc7d1/expo-telemetry.json (dns block)
  • iojs.org
    • Triggering command: curl --fail --compressed -q -L -s REDACTED -o - (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] 現在地表示 Add current location display to maps using expo-location and TanStack Query Aug 14, 2025
Copilot AI requested a review from naoki-00-ito August 14, 2025 07:55
@naoki-00-ito naoki-00-ito marked this pull request as ready for review August 15, 2025 07:04
@naoki-00-ito naoki-00-ito merged commit e5cf266 into develop Aug 15, 2025
2 checks passed
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.

現在地表示

2 participants