mirror of
https://github.com/lemeow125/StudE-Frontend.git
synced 2024-11-17 06:19:25 +08:00
Homepage improvements
This commit is contained in:
parent
17b41cde65
commit
40c52f1419
3 changed files with 39 additions and 11 deletions
7
app.json
7
app.json
|
@ -28,7 +28,12 @@
|
||||||
"android.permission.ACCESS_COARSE_LOCATION",
|
"android.permission.ACCESS_COARSE_LOCATION",
|
||||||
"android.permission.ACCESS_FINE_LOCATION",
|
"android.permission.ACCESS_FINE_LOCATION",
|
||||||
"android.permission.FOREGROUND_SERVICE"
|
"android.permission.FOREGROUND_SERVICE"
|
||||||
]
|
],
|
||||||
|
"config":{
|
||||||
|
"googleMaps":{
|
||||||
|
"apiKey": "AIzaSyCw2Fhwe7nGUbGQATnjDfEYfoZFN6lXGeA"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"web": {
|
"web": {
|
||||||
"favicon": "./assets/favicon.png"
|
"favicon": "./assets/favicon.png"
|
||||||
|
|
|
@ -33,10 +33,10 @@
|
||||||
"react-native-safe-area-context": "4.5.0",
|
"react-native-safe-area-context": "4.5.0",
|
||||||
"react-native-screens": "~3.20.0",
|
"react-native-screens": "~3.20.0",
|
||||||
"react-native-select-dropdown": "^3.3.4",
|
"react-native-select-dropdown": "^3.3.4",
|
||||||
|
"react-native-svg": "13.4.0",
|
||||||
"react-query": "^3.39.3",
|
"react-query": "^3.39.3",
|
||||||
"react-redux": "^8.1.1",
|
"react-redux": "^8.1.1",
|
||||||
"redux": "^4.2.1",
|
"redux": "^4.2.1"
|
||||||
"react-native-svg": "13.4.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.20.0",
|
"@babel/core": "^7.20.0",
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
import styles, { Viewport } from "../../styles";
|
import styles, { Viewport } from "../../styles";
|
||||||
import { View, Text } from "react-native";
|
import { View, Text } from "react-native";
|
||||||
import { useSelector } from "react-redux";
|
|
||||||
import { RootState } from "../../features/redux/Store/Store";
|
|
||||||
import AnimatedContainer from "../../components/AnimatedContainer/AnimatedContainer";
|
import AnimatedContainer from "../../components/AnimatedContainer/AnimatedContainer";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import MapView, { Animated as AnimatedMap, UrlTile } from "react-native-maps";
|
import MapView, { UrlTile } from "react-native-maps";
|
||||||
import * as Location from "expo-location";
|
import * as Location from "expo-location";
|
||||||
import GetDistance from "../../components/GetDistance/GetDistance";
|
import GetDistance from "../../components/GetDistance/GetDistance";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../components/Button/Button";
|
||||||
import { colors } from "../../styles";
|
|
||||||
|
|
||||||
type LocationType = Location.LocationObject;
|
type LocationType = Location.LocationObject;
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
const [location, setLocation] = useState<LocationType | null>(null);
|
const [location, setLocation] = useState<LocationType | null>(null);
|
||||||
|
@ -17,6 +13,8 @@ export default function Home() {
|
||||||
const [feedback, setFeedback] = useState(
|
const [feedback, setFeedback] = useState(
|
||||||
"To continue, please allow Stud-E permission to location services"
|
"To continue, please allow Stud-E permission to location services"
|
||||||
);
|
);
|
||||||
|
const urlProvider =
|
||||||
|
"https://tile.thunderforest.com/atlas/{z}/{x}/{y}.png?apikey=0f5cb5930d7642a8a921daea650754d9";
|
||||||
const ustpCoords = {
|
const ustpCoords = {
|
||||||
latitude: 8.4857,
|
latitude: 8.4857,
|
||||||
longitude: 124.6565,
|
longitude: 124.6565,
|
||||||
|
@ -42,7 +40,7 @@ export default function Home() {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const interval = setInterval(() => {
|
const interval = setInterval(() => {
|
||||||
requestLocation();
|
requestLocation();
|
||||||
}, 1000);
|
}, 10000);
|
||||||
|
|
||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
});
|
});
|
||||||
|
@ -67,6 +65,7 @@ export default function Home() {
|
||||||
return (
|
return (
|
||||||
<MapView
|
<MapView
|
||||||
style={styles.map}
|
style={styles.map}
|
||||||
|
mapType="none"
|
||||||
initialRegion={ustpCoords}
|
initialRegion={ustpCoords}
|
||||||
showsUserLocation={true}
|
showsUserLocation={true}
|
||||||
scrollEnabled={false}
|
scrollEnabled={false}
|
||||||
|
@ -74,12 +73,24 @@ export default function Home() {
|
||||||
rotateEnabled={false}
|
rotateEnabled={false}
|
||||||
followsUserLocation={true}
|
followsUserLocation={true}
|
||||||
minZoomLevel={15}
|
minZoomLevel={15}
|
||||||
|
customMapStyle={[
|
||||||
|
{
|
||||||
|
featureType: "poi",
|
||||||
|
stylers: [
|
||||||
|
{
|
||||||
|
visibility: "off",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]}
|
||||||
>
|
>
|
||||||
<UrlTile
|
<UrlTile
|
||||||
urlTemplate="https://c.tile.openstreetmap.org/${z}/${x}/${y}.png"
|
urlTemplate={urlProvider}
|
||||||
shouldReplaceMapContent={true}
|
shouldReplaceMapContent={true}
|
||||||
|
tileCachePath=""
|
||||||
maximumZ={19}
|
maximumZ={19}
|
||||||
flipY={false}
|
flipY={false}
|
||||||
|
zIndex={1}
|
||||||
/>
|
/>
|
||||||
</MapView>
|
</MapView>
|
||||||
);
|
);
|
||||||
|
@ -96,6 +107,17 @@ export default function Home() {
|
||||||
width: Viewport.width * 0.8,
|
width: Viewport.width * 0.8,
|
||||||
alignSelf: "center",
|
alignSelf: "center",
|
||||||
}}
|
}}
|
||||||
|
customMapStyle={[
|
||||||
|
{
|
||||||
|
featureType: "poi",
|
||||||
|
stylers: [
|
||||||
|
{
|
||||||
|
visibility: "off",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
mapType="none"
|
||||||
showsUserLocation={true}
|
showsUserLocation={true}
|
||||||
scrollEnabled={false}
|
scrollEnabled={false}
|
||||||
zoomEnabled={false}
|
zoomEnabled={false}
|
||||||
|
@ -110,10 +132,11 @@ export default function Home() {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<UrlTile
|
<UrlTile
|
||||||
urlTemplate="https://c.tile.openstreetmap.org/${z}/${x}/${y}.png"
|
urlTemplate={urlProvider}
|
||||||
shouldReplaceMapContent={true}
|
shouldReplaceMapContent={true}
|
||||||
maximumZ={19}
|
maximumZ={19}
|
||||||
flipY={false}
|
flipY={false}
|
||||||
|
zIndex={1}
|
||||||
/>
|
/>
|
||||||
</MapView>
|
</MapView>
|
||||||
<Text style={styles.text_white_small}>
|
<Text style={styles.text_white_small}>
|
||||||
|
|
Loading…
Reference in a new issue