Skip to content
Snippets Groups Projects
Commit 2d221c40 authored by Julia Friesel's avatar Julia Friesel
Browse files

Produce horizontal grid once, not for every column

parent cd1e689a
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ import React, { Component } from 'react' ...@@ -2,7 +2,7 @@ import React, { Component } from 'react'
import { View, FlatList } from 'react-native' import { View, FlatList } from 'react-native'
import range from 'date-range' import range from 'date-range'
import { LocalDate } from 'js-joda' import { LocalDate } from 'js-joda'
import { yAxis, normalizeToScale } from './y-axis' import { yAxis, normalizeToScale, horizontalGrid } from './y-axis'
import DayColumn from './day-column' import DayColumn from './day-column'
import { getCycleDay, cycleDaysSortedByDate, getAmountOfCycleDays } from '../../db' import { getCycleDay, cycleDaysSortedByDate, getAmountOfCycleDays } from '../../db'
import styles from './styles' import styles from './styles'
...@@ -43,7 +43,8 @@ export default class CycleChart extends Component { ...@@ -43,7 +43,8 @@ export default class CycleChart extends Component {
return ( return (
<View style={{ flexDirection: 'row' }}> <View style={{ flexDirection: 'row' }}>
{yAxisView} {yAxisView}
<FlatList {horizontalGrid}
{<FlatList
horizontal={true} horizontal={true}
inverted={true} inverted={true}
showsHorizontalScrollIndicator={false} showsHorizontalScrollIndicator={false}
...@@ -53,7 +54,7 @@ export default class CycleChart extends Component { ...@@ -53,7 +54,7 @@ export default class CycleChart extends Component {
initialNumToRender={15} initialNumToRender={15}
maxToRenderPerBatch={5} maxToRenderPerBatch={5}
> >
</FlatList> </FlatList>}
</View> </View>
) )
} }
......
...@@ -8,7 +8,6 @@ import config from './config' ...@@ -8,7 +8,6 @@ import config from './config'
import { getOrCreateCycleDay } from '../../db' import { getOrCreateCycleDay } from '../../db'
import cycleModule from '../../lib/cycle' import cycleModule from '../../lib/cycle'
import setUpFertilityStatusFunc from './nfp-lines' import setUpFertilityStatusFunc from './nfp-lines'
import { horizontalGrid } from './y-axis'
const getCycleDayNumber = cycleModule().getCycleDayNumber const getCycleDayNumber = cycleModule().getCycleDayNumber
const label = styles.column.label const label = styles.column.label
...@@ -69,7 +68,7 @@ export default class DayColumn extends Component { ...@@ -69,7 +68,7 @@ export default class DayColumn extends Component {
columnElements.push(mucusIcon) columnElements.push(mucusIcon)
} }
columnElements.push(cycleDayLabel, dateLabel, horizontalGrid) columnElements.push(cycleDayLabel, dateLabel)
if(nfpLineInfo.drawFhmLine) { if(nfpLineInfo.drawFhmLine) {
const fhmLine = (<View const fhmLine = (<View
......
...@@ -42,8 +42,7 @@ const styles = { ...@@ -42,8 +42,7 @@ const styles = {
height: config.chartHeight, height: config.chartHeight,
borderStyle: 'solid', borderStyle: 'solid',
borderColor: 'grey', borderColor: 'grey',
borderWidth: 1, borderWidth: 0.5
backgroundColor: 'transparent'
} }
}, },
bleedingIcon: { bleedingIcon: {
...@@ -67,6 +66,9 @@ const styles = { ...@@ -67,6 +66,9 @@ const styles = {
yAxis: { yAxis: {
height: config.chartHeight, height: config.chartHeight,
width: config.columnWidth, width: config.columnWidth,
borderRightWidth: 0.5,
borderColor: 'lightgrey',
borderStyle: 'solid'
}, },
yAxisLabel: { yAxisLabel: {
position: 'absolute', position: 'absolute',
...@@ -76,10 +78,12 @@ const styles = { ...@@ -76,10 +78,12 @@ const styles = {
fontWeight: 'bold' fontWeight: 'bold'
}, },
horizontalGrid: { horizontalGrid: {
position:'absolute',
borderColor: 'lightgrey', borderColor: 'lightgrey',
borderWidth: 1, borderWidth: 0.5,
width: config.columnWidth, width: '100%',
borderStyle: 'solid' borderStyle: 'solid',
left: config.columnWidth
}, },
nfpLine: { nfpLine: {
borderColor: '#00b159', borderColor: '#00b159',
......
...@@ -37,8 +37,6 @@ export const yAxis = makeYAxis() ...@@ -37,8 +37,6 @@ export const yAxis = makeYAxis()
export const horizontalGrid = yAxis.tickPositions.map(tick => { export const horizontalGrid = yAxis.tickPositions.map(tick => {
return ( return (
<View <View
position='absolute'
width='100%'
top={tick} top={tick}
{...styles.horizontalGrid} {...styles.horizontalGrid}
key={tick} key={tick}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment