|
@ -5,6 +5,33 @@ 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 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) { |
|
|
export default function MapFeedScreen(props) { |
|
|
HeaderBarMenu(props.navigation); |
|
|
HeaderBarMenu(props.navigation); |
|
@ -21,29 +48,22 @@ export default function MapFeedScreen(props) { |
|
|
floodZones: false, |
|
|
floodZones: false, |
|
|
riverFlood: false, |
|
|
riverFlood: false, |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
const markers = useSocketMarkers(); |
|
|
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}> |
|
|
<View style={styles.container}> |
|
|
<OpenStreetMap |
|
|
<OpenStreetMap |
|
|
markers={markers} |
|
|
markers={markers} |
|
|
centerUserLocation={true} |
|
|
centerUserLocation={true} |
|
|
dataOptionsToShow={dataOptionsToShow} |
|
|
dataOptionsToShow={dataOptionsToShow} |
|
|
setDataOptionsToShow={setDataOptionsToShow} |
|
|
setDataOptionsToShow={setDataOptionsToShow} |
|
|
/> |
|
|
|
|
|
<LoadingMarkersModal |
|
|
|
|
|
show={markers.markers.size <= 0}/> |
|
|
|
|
|
|
|
|
/> |
|
|
|
|
|
<LoadingMarkersModal show={markers.markers.size <= 0} /> |
|
|
</View> |
|
|
</View> |
|
|
):( |
|
|
|
|
|
<View> |
|
|
|
|
|
<Text>Apresentar um erro no futuro</Text> |
|
|
|
|
|
</View> |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
) : ( |
|
|
|
|
|
<NoLocationProvided /> |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -52,4 +72,17 @@ const styles = StyleSheet.create({ |
|
|
flex: 1, |
|
|
flex: 1, |
|
|
backgroundColor: "#FFF", |
|
|
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", |
|
|
|
|
|
}, |
|
|
}); |
|
|
}); |