Browse Source

Implementing warning for not allowing getLocation

master
GabrielTrettel 3 years ago
parent
commit
d27681de37
  1. 55
      src/app/screens/MapFeedScreen.js

55
src/app/screens/MapFeedScreen.js

@ -5,6 +5,33 @@ import attachFocusToQuery from "../hooks/useFocus";
import HeaderBarMenu from "../components/HeaderBarMenu";
import useSocketMarkers from "../hooks/useSocketMarkers";
import LoadingMarkersModal from "../components/LoadingMarkersModal";
import colors from "../config/colors";
import {dimensions} from "../config/dimensions";
import { MaterialCommunityIcons } from "@expo/vector-icons";
function NoLocationProvided() {
return (
<View
style={{
flex: 1,
alignItems: "center",
alignSelf: "center",
alignContent: "center",
alignItems: "center",
justifyContent: "center",
}}
>
<MaterialCommunityIcons
name="earth-off"
size={58}
color={colors.primary}
alignSelf="center"
/>
<Text style={styles.txtHeader}>Localização não fornecida{"\n"}</Text>
<Text style={styles.txtStyle}>Para utilizar as funcionalidades do mapa é preciso ativar a localização</Text>
</View>
);
}
export default function MapFeedScreen(props) {
HeaderBarMenu(props.navigation);
@ -24,11 +51,8 @@ export default function MapFeedScreen(props) {
});
const markers = useSocketMarkers();
console.log("============= qtd markers " + markers.markers.size + " ================" )
// console.log("location: " + JSON.stringify(global.location))
return (
(global.location) ? (
return global.location ? (
<View style={styles.container}>
<OpenStreetMap
markers={markers}
@ -36,14 +60,10 @@ export default function MapFeedScreen(props) {
dataOptionsToShow={dataOptionsToShow}
setDataOptionsToShow={setDataOptionsToShow}
/>
<LoadingMarkersModal
show={markers.markers.size <= 0}/>
<LoadingMarkersModal show={markers.markers.size <= 0} />
</View>
):(
<View>
<Text>Apresentar um erro no futuro</Text>
</View>
)
) : (
<NoLocationProvided />
);
}
@ -52,4 +72,17 @@ const styles = StyleSheet.create({
flex: 1,
backgroundColor: "#FFF",
},
txtHeader: {
color: colors.primary,
fontSize: dimensions.text.header,
fontWeight: "bold",
textAlign: "center",
paddingTop: 12,
paddingBottom: 20,
},
txtStyle: {
fontSize: dimensions.text.secondary,
fontWeight: "bold",
textAlign: "center",
},
});
Loading…
Cancel
Save