Replace svg with ART in chart

This commit is contained in:
Julia Friesel
2018-11-21 13:44:29 +01:00
parent 6e3cbc8e39
commit c0be1b7848
4 changed files with 50 additions and 43 deletions
+15 -11
View File
@@ -1,5 +1,5 @@
import React, { Component } from 'react'
import { Circle, Line } from 'react-native-svg'
import { Path, Shape } from 'react-native/Libraries/ART/ReactNativeART'
import styles from './styles'
import config from '../../config'
@@ -27,11 +27,15 @@ export default class DotAndLine extends Component {
}
const dotStyle = exclude ? styles.curveDotsExcluded : styles.curveDots
const radius = dotStyle.r
const dot = (
<Circle
cx={config.columnMiddle}
cy={y}
{...dotStyle}
<Shape
d={new Path()
.moveTo(config.columnMiddle, y - radius)
.arc(0, radius * 2, radius)
.arc(0, radius * -2, radius)
}
fill={dotStyle.fill}
key='dot'
/>
)
@@ -42,12 +46,12 @@ export default class DotAndLine extends Component {
function makeLine(currY, middleY, x, excludeLine) {
const lineStyle = excludeLine ? styles.curveExcluded : styles.curve
return <Line
x1={config.columnMiddle}
y1={currY}
x2={x}
y2={middleY}
{...lineStyle}
return <Shape
stroke={lineStyle.stroke}
d={new Path()
.moveTo(config.columnMiddle, currY)
.lineTo(x, middleY)
}
key={x.toString()}
/>
}