Move YAxis & HorizontalGrid components in a common conditional expression
This commit is contained in:
+16
-17
@@ -2,19 +2,19 @@ import React, { Component } from 'react'
|
|||||||
import { View, FlatList, ActivityIndicator } from 'react-native'
|
import { View, FlatList, ActivityIndicator } from 'react-native'
|
||||||
import { LocalDate } from 'js-joda'
|
import { LocalDate } from 'js-joda'
|
||||||
|
|
||||||
|
import AppLoadingView from '../app-loading'
|
||||||
import YAxis from './y-axis'
|
import YAxis from './y-axis'
|
||||||
import nfpLines from './nfp-lines'
|
import nfpLines from './nfp-lines'
|
||||||
import DayColumn from './day-column'
|
import DayColumn from './day-column'
|
||||||
import HorizontalGrid from './horizontal-grid'
|
import HorizontalGrid from './horizontal-grid'
|
||||||
|
|
||||||
import { getCycleDaysSortedByDate, getAmountOfCycleDays } from '../../db'
|
import { getCycleDaysSortedByDate, getAmountOfCycleDays } from '../../db'
|
||||||
import styles from './styles'
|
import nothingChanged from '../../db/db-unchanged'
|
||||||
import { scaleObservable } from '../../local-storage'
|
import { scaleObservable } from '../../local-storage'
|
||||||
|
|
||||||
import config from '../../config'
|
import config from '../../config'
|
||||||
|
|
||||||
import AppLoadingView from '../app-loading'
|
import styles from './styles'
|
||||||
|
|
||||||
import nothingChanged from '../../db/db-unchanged'
|
|
||||||
|
|
||||||
export default class CycleChart extends Component {
|
export default class CycleChart extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -121,25 +121,24 @@ export default class CycleChart extends Component {
|
|||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
onLayout={this.onLayout}
|
onLayout={this.onLayout}
|
||||||
style={{ flexDirection: 'row', flex: 1 }}
|
style={styles.container}
|
||||||
>
|
>
|
||||||
{!chartLoaded && <AppLoadingView />}
|
{!chartLoaded && <AppLoadingView />}
|
||||||
|
|
||||||
{chartHeight && chartLoaded && (
|
{chartHeight && chartLoaded && (
|
||||||
<YAxis
|
<React.Fragment>
|
||||||
height={this.columnHeight}
|
<YAxis
|
||||||
symptomsToDisplay={this.symptomRowSymptoms}
|
height={this.columnHeight}
|
||||||
symptomsSectionHeight={this.symptomRowHeight}
|
symptomsToDisplay={this.symptomRowSymptoms}
|
||||||
/>
|
symptomsSectionHeight={this.symptomRowHeight}
|
||||||
|
/>
|
||||||
|
<HorizontalGrid
|
||||||
|
height={this.columnHeight}
|
||||||
|
startPosition={this.symptomRowHeight}
|
||||||
|
/>
|
||||||
|
</React.Fragment>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{chartHeight && chartLoaded && (
|
|
||||||
<HorizontalGrid
|
|
||||||
height={this.columnHeight}
|
|
||||||
startPosition={this.symptomRowHeight}
|
|
||||||
/>)
|
|
||||||
}
|
|
||||||
|
|
||||||
{chartHeight &&
|
{chartHeight &&
|
||||||
<FlatList
|
<FlatList
|
||||||
horizontal={true}
|
horizontal={true}
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ const orangeColor = '#bc6642'
|
|||||||
const mintColor = '#6ca299'
|
const mintColor = '#6ca299'
|
||||||
|
|
||||||
const styles = {
|
const styles = {
|
||||||
|
container: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
flex: 1,
|
||||||
|
},
|
||||||
curve: {
|
curve: {
|
||||||
stroke: colorTemperature,
|
stroke: colorTemperature,
|
||||||
strokeWidth: lineWidth,
|
strokeWidth: lineWidth,
|
||||||
|
|||||||
Reference in New Issue
Block a user