Skip to content

Commit

Permalink
feat: map feature now builds app on the selected location given.
Browse files Browse the repository at this point in the history
  • Loading branch information
gsinghg19 committed May 16, 2023
1 parent cd88444 commit 7a7df79
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 9 additions & 5 deletions components/Map.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import React from "react";
import MapView from "react-native-maps";
import { useSelector } from "react-redux";
import tw from "twrnc";
import { selectOrigin } from "../slices/navSlice";

const Map = () => {
const origin = useSelector(selectOrigin);

return (
<MapView
mapType="mutedStandard"
style={tw`flex-1`}
initialRegion={{
latitude: 37.78825,
longitude: -122.4324,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
latitude: origin.location.lat,
longitude: origin.location.lng,
latitudeDelta: 0.005,
longitudeDelta: 0.005,
}}
/>
></MapView>
);
};

Expand Down
4 changes: 2 additions & 2 deletions slices/navSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ export const navSlice = createSlice({
state.origin = action.payload;
},
setDestination: (state, action) => {
state.origin = action.payload;
state.destination = action.payload;
},
setTravelTimeInformation: (state, action) => {
state.origin = action.payload;
state.travelTimeInformation = action.payload;
},
},
});
Expand Down

0 comments on commit 7a7df79

Please sign in to comment.