Browse Source

Adding null check in pluviometer for chart data points

master
GabrielTrettel 4 years ago
parent
commit
0f33950e24
  1. 18
      src/app/components/MapModal.js

18
src/app/components/MapModal.js

@ -156,13 +156,25 @@ function reviews(props) {
} }
function moreInfo(props) { function moreInfo(props) {
const hasData = props.data.values.length > 0;
return ( return (
<View style={styles.pluviometer_diary}>
<View
style={{
height: hasData ? chartHeight * 1.4 : 70,
paddingVertical: 20,
}}
>
{!hasData ? (
<Text style={{ ...styles.text, alignSelf: "center" }}>
Nenhum dado disponível
</Text>
) : (
<PluviometerGraphics <PluviometerGraphics
chartHeight={chartHeight} chartHeight={chartHeight}
values={props.data.values} values={props.data.values}
labels={props.data.labels} labels={props.data.labels}
/> />
)}
</View> </View>
); );
} }
@ -258,10 +270,6 @@ const styles = StyleSheet.create({
fontWeight: "500", fontWeight: "500",
fontSize: dimensions.text.default, fontSize: dimensions.text.default,
}, },
pluviometer_diary: {
height: chartHeight * 1.4,
paddingVertical: 20,
},
}); });
export default MapModal; export default MapModal;
Loading…
Cancel
Save