feat(search): add viewport bias for location-aware geocoding

- Add mapCenter state to store (lat/lon/zoom)
- Track map center on moveend in MapView
- Pass mapCenter to searchGeocode from SearchBar
- Update searchGeocode API call to include viewport params

Search results now prioritize locations near the current map view.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Matt 2026-04-26 04:03:52 +00:00
commit b12ebe672e
4 changed files with 158 additions and 3 deletions

View file

@ -40,6 +40,10 @@ export const useStore = create((set, get) => ({
setUserLocation: (loc) => set({ userLocation: loc }),
setGeoPermission: (p) => set({ geoPermission: p }),
// ── Map viewport (for search bias) ──
mapCenter: null, // { lat, lon, zoom }
setMapCenter: (center) => set({ mapCenter: center }),
// ── Mode ──
mode: 'auto', // 'auto' | 'pedestrian' | 'bicycle'
setMode: (mode) => set({ mode }),