Show loading message

This commit is contained in:
Julia Friesel
2018-08-26 18:28:59 +02:00
parent 5460d574e2
commit 2a07ce4ef2
+9 -3
View File
@@ -98,8 +98,13 @@ export default class CycleChart extends Component {
onLayout={this.onLayout} onLayout={this.onLayout}
style={{ flexDirection: 'row', flex: 1 }} style={{ flexDirection: 'row', flex: 1 }}
> >
{!this.state.chartHeight && <Text>Loading...</Text>} {!this.state.chartLoaded &&
{this.state.chartHeight && <View style={{width: '100%', justifyContent: 'center', alignItems: 'center'}}>
<Text>Loading...</Text>
</View>
}
{this.state.chartHeight && this.state.chartLoaded &&
<View <View
style={[styles.yAxis, { style={[styles.yAxis, {
height: columnHeight, height: columnHeight,
@@ -109,7 +114,7 @@ export default class CycleChart extends Component {
{makeYAxisLabels(columnHeight)} {makeYAxisLabels(columnHeight)}
</View>} </View>}
{this.state.chartHeight && makeHorizontalGrid(columnHeight, symptomRowHeight)} {this.state.chartHeight && this.state.chartLoaded && makeHorizontalGrid(columnHeight, symptomRowHeight)}
{this.state.chartHeight && {this.state.chartHeight &&
<FlatList <FlatList
@@ -121,6 +126,7 @@ export default class CycleChart extends Component {
keyExtractor={item => item.dateString} keyExtractor={item => item.dateString}
initialNumToRender={15} initialNumToRender={15}
maxToRenderPerBatch={5} maxToRenderPerBatch={5}
onLayout={() => this.setState({chartLoaded: true})}
/> />
} }
</View> </View>