Skip to content

Crashes on android when using strokeDasharray property #743

@Dannark

Description

@Dannark

Hi guys, today I noticed that if we use the strokeDasharray property from propsForBackgroundLines on Android, it crashes without giving any error hints. (There is an error in Logcat, though, but it doesn’t help much.)

To replicate it:

const chartConfig = {
    backgroundGradientFromOpacity: 0,
    backgroundGradientToOpacity: 0,
    color: () => colors.absolut.green,
    labelColor: () => colors.button.dismiss.disabled,
    decimalPlaces: 2,
    strokeWidth: 2,
    propsForDots: {
      r: '0',
    },
    propsForBackgroundLines: {
      // strokeDasharray: [], //this line causes the crash
      stroke: colors.menu.tertiary,
      strokeWidth: 1,
    },
  };

return (
     ...
     <LineChart
          data={{
            labels: chartData.labels,
            datasets: [{ data: chartData.data }],
          }}
          width={CHART_WIDTH}
          height={220}
          chartConfig={chartConfig}
          withVerticalLines={false}
          withHorizontalLines={true}
          withInnerLines={true}
          withOuterLines={false}
          withShadow={false}
          // fromZero
          withVerticalLabels={true}
          withHorizontalLabels={true}
          style={styles.chart}
     />
     ...
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions