Browse Source

Implementing no gps locations error in mapfeed screen

master
GabrielTrettel 3 years ago
parent
commit
e1faac4edd
  1. 47
      src/app/components/NoGPSError.js
  2. 7
      src/app/screens/MapFeedScreen.js

47
src/app/components/NoGPSError.js

@ -0,0 +1,47 @@
import React from "react";
import { StyleSheet, Text, View } from "react-native";
import { MaterialCommunityIcons } from "@expo/vector-icons";
import colors from "../config/colors";
import { dimensions } from "../config/dimensions";
export default function NoGPSError() {
return (
<View style={styles.containter}>
<View style={styles.icon}>
<MaterialCommunityIcons
name="map-marker-outline"
size={58}
color={colors.primary}
alignSelf="center"
/>
</View>
<Text style={styles.txtHeader}>Ops, algo deu errado...</Text>
<Text style={styles.txtStyle}>
Não foi possível definir a sua localização. Ative o GPS e tente novamente.
</Text>
</View>
);
}
const styles = StyleSheet.create({
containter: {
flex: 1,
justifyContent: "center",
padding: 10,
},
icon:{
alignSelf:"center",
},
txtHeader: {
color: colors.primary,
fontSize: dimensions.text.header,
fontWeight: "bold",
textAlign: "center",
paddingBottom: 20,
},
txtStyle: {
fontSize: dimensions.text.secondary,
fontWeight: "bold",
textAlign: "center",
},
});

7
src/app/screens/MapFeedScreen.js

@ -5,6 +5,7 @@ import attachFocusToQuery from "../hooks/useFocus";
import HeaderBarMenu from "../components/HeaderBarMenu"; import HeaderBarMenu from "../components/HeaderBarMenu";
import useSocketMarkers from "../hooks/useSocketMarkers"; import useSocketMarkers from "../hooks/useSocketMarkers";
import LoadingMarkersModal from "../components/LoadingMarkersModal"; import LoadingMarkersModal from "../components/LoadingMarkersModal";
import NoGPSError from "../components/NoGPSError";
export default function MapFeedScreen(props) { export default function MapFeedScreen(props) {
HeaderBarMenu(props.navigation); HeaderBarMenu(props.navigation);
@ -28,7 +29,7 @@ export default function MapFeedScreen(props) {
// console.log("location: " + JSON.stringify(global.location)) // console.log("location: " + JSON.stringify(global.location))
return ( return (
(global.location) ? (
(!global.location) ? (
<View style={styles.container}> <View style={styles.container}>
<OpenStreetMap <OpenStreetMap
markers={markers} markers={markers}
@ -40,9 +41,7 @@ export default function MapFeedScreen(props) {
show={markers.markers.size <= 0}/> show={markers.markers.size <= 0}/>
</View> </View>
):( ):(
<View>
<Text>Apresentar um erro no futuro</Text>
</View>
<NoGPSError/>
) )
); );
} }

Loading…
Cancel
Save