Skip to content

Commit

Permalink
feat(connected-location-field): update focus point based on geolocation
Browse files Browse the repository at this point in the history
  • Loading branch information
miles-grant-ibigroup committed Nov 1, 2021
1 parent 85f28da commit 1b357be
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/components/form/connect-location-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ export default function connectLocationField (StyledLocationField, options = {})
const activeSearch = getActiveSearch(state)
const query = activeSearch ? activeSearch.query : currentQuery

const geocoderConfig = config.geocoder
if (state.otp.location.currentPosition.coords) {
const {latitude: lat, longitude: lon} = state.otp.location.currentPosition.coords
geocoderConfig.focusPoint = {lat, lon}
}

const stateToProps = {
currentPosition,
geocoderConfig: config.geocoder,
geocoderConfig,
layerColorMap: config.geocoder?.resultsColors || {},
nearbyStops,
sessionSearches,
Expand Down

0 comments on commit 1b357be

Please sign in to comment.