提高 Victory Native / VictoryChart 的渲染速度

Yos*_*ssi 8 react-native victory-charts

我正在刷卡内渲染 VictoryChart,并且刷卡很慢。我怀疑原因是图表渲染缓慢(当替换为静态图像时,滑动速度很快)。

阅读各种关于 Victory 和 Victory Native 性能的讨论,似乎渲染缓慢的原因之一是动画。

我没有在图表中做任何动画。

除了我在下面的代码中所做的之外,我是否必须明确禁用动画?

任何其他建议如何提高此图表的渲染性能?(我知道对值进行预先排序可能会有所帮助。还有什么别的吗?)

<VictoryChart scale={{ x: 'time' }}>
  <VictoryAxis tickFormat={(t) => `${t.getHours()}:${t.getMinutes()}`}/>
  <VictoryAxis dependentAxis/>

  <VictoryCandlestick data={candleStickData} />

  <VictoryLine labels={['']}
    animate={{ duration: 0, onLoad: { duration: 0 } }}
    data={[
      { x: dateStartX, y: dateStartY },
      { x: dateStartX, y: dateStartY }
    ]}
  />

  <VictoryLine
    labels={['']}
    animate={{ duration: 0, onLoad: { duration: 0 } }}
    data={[
      { x: secondDateStartX, y: secondDateStartY },
      { x: secondDateStartX, y: secondDateStartY }
    ]}
  />

</VictoryChart>
Run Code Online (Sandbox Code Playgroud)