在React native中将组件作为数据传递给Carousel

问题描述

我对在React Native中将组件作为数据传递给Carousel有疑问。

以下是用于更好理解的仿真器:

enter image description here

现在,该图来自外部软件包(React native Victory),并且天的值在Array(X轴-天,Y轴-利润(稍后将从Firebase获取值...)中定义为如下:

  const data = {
// X will be days,Y will get value from Syncronhized calendar
Weekdays: [
  { x: "Sun",y: 50 },{ x: "Mon",y: 100 },{ x: "Tue",y: 150 },{ x: "Wed",y: 200 },{ x: "Thr",y: 250 },{ x: "Fri",y: 300 },],

轮播代码如下:

<Carousel
      layout={"tinder"}
      ref={carouselRef}
      data={} //Here i Want to Pass the Graphs.
      renderItem={RenderItem}
      sliderWidth={width}
      itemWidth={width - 10}
      swipeThreshold={100}
      layoutCardOffset={-12}
      inactiveSlideOpacity={0.4}
      containerCustomStyle={{
        overflow: "visible",marginVertical: 30,}}
      contentContainerCustomStyle={{
        paddingTop: 14,}}
    />

我要通过图表的 data = {},这可能吗?

图形代码

<VictoryChart>
      <VictoryGroup offset={20}>
        <VictoryBar data={data.Weekdays} />
      </VictoryGroup>
    </VictoryChart>

我想创建3-4个图表并在轮播中使用

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...