react-native-charts-wrapper icon indicating copy to clipboard operation
react-native-charts-wrapper copied to clipboard

centerViewToAnimated not working in Android

Open aureosouza opened this issue 5 years ago • 0 comments

Expected Behavior

Android should work the same way as iOS

Actual Behavior

Android is not moving on centerViewToAnimated, iOS works normally. Using moveViewToX in Android as a workaround.

Data and config

  const onSelect = (index) => {
    chartRef.current.centerViewToAnimated(index, 0, 'left', 500);
  };

  return (
    <BarChart
      ref={chartRef}
      style={styles.chart}
      data={chartDataSet}
      xAxis={xAxis}
      yAxis={yAxis}
      drawGridBackground={false}
      animation={{ durationX: 2000 }}
      legend={legend}
      gridBackgroundColor={processColor(Colors.white)}
      visibleRange={{ x: { min: 5, max: 5 }, y: { min: 0, max: 100 } }}
      drawBarShadow={false}
      drawHighlightArrow={false}
      onSelect={(event) => onSelect(event.nativeEvent.x)}
      drawGridLines={false}
      granularityEnabled={false}
      highlightFullBarEnabled={false}
      drawInside={false}
      drawBorders={false}
      doubleTapToZoomEnabled={false}
      pinchZoom={false}
      highlights={[{ x: 0, dataSetIndex: visitIndex }]}
      chartDescription={{ text: '' }}
    />
  );

Steps to Reproduce the Problem

Try to click the bars in chart, iOS centers correctly, android doesn't.

Specifications

  • Versions: "react-native-charts-wrapper": "^0.5.7" "react-native": "0.63.2"
  • Platform: Android 10

aureosouza avatar Feb 11 '21 09:02 aureosouza