Handle clicks on day column through trasnparent rectangle
This commit is contained in:
+20
-1
@@ -78,7 +78,6 @@ export default class CycleChart extends Component {
|
|||||||
fill="lightgrey"
|
fill="lightgrey"
|
||||||
strokeWidth="1"
|
strokeWidth="1"
|
||||||
stroke="grey"
|
stroke="grey"
|
||||||
onPress={() => this.passDateToDayView(columnInfo.label)}
|
|
||||||
/>
|
/>
|
||||||
<Text
|
<Text
|
||||||
stroke="grey"
|
stroke="grey"
|
||||||
@@ -94,6 +93,22 @@ export default class CycleChart extends Component {
|
|||||||
return xAxisTicks.map(this.makeDayColumn.bind(this))
|
return xAxisTicks.map(this.makeDayColumn.bind(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
placeTouchHandlerRectangles() {
|
||||||
|
return this.xAxisTicks.map(columnInfo => {
|
||||||
|
return (
|
||||||
|
<Rect
|
||||||
|
key={columnInfo.label}
|
||||||
|
x={columnInfo.rightOffset}
|
||||||
|
y={top}
|
||||||
|
width={columnWidth}
|
||||||
|
height={bottom - top - dateRow.height}
|
||||||
|
fillOpacity={0}
|
||||||
|
onPress={() => this.passDateToDayView(columnInfo.label)}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
placeBleedingSymbolsOnColumns() {
|
placeBleedingSymbolsOnColumns() {
|
||||||
return this.state.bleedIconCoordinates.map(x => {
|
return this.state.bleedIconCoordinates.map(x => {
|
||||||
return (<Circle key={x} cx={x} cy="50" r="7" fill="red" />)
|
return (<Circle key={x} cx={x} cy="50" r="7" fill="red" />)
|
||||||
@@ -150,6 +165,10 @@ export default class CycleChart extends Component {
|
|||||||
|
|
||||||
{ this.makeTemperatureCurves() }
|
{ this.makeTemperatureCurves() }
|
||||||
|
|
||||||
|
{/* we place a trasnparent rectangle over every day column */}
|
||||||
|
{/* so that all elements including the line and circles are clickable */}
|
||||||
|
{ this.placeTouchHandlerRectangles() }
|
||||||
|
|
||||||
</Svg>
|
</Svg>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user