Warning: Failed prop type: Invalid prop `range` supplied to `VictoryBar`

huangapple go评论62阅读模式
英文:

Warning: Failed prop type: Invalid prop `range` supplied to `VictoryBar`

问题

我在React Native中使用Victory Bar,并对发生的情况感到非常困惑。我收到以下错误:

    在VictoryBar中
    在VictoryStackBase中创建(由VictoryStack创建)

我有以下代码:

<VictoryStack
                horizontal={true}
                width={310}
                height={90}
                alignment="start"
                colorScale={graphicColorDeploy}
                style={{
                  justifyContent: 'flex-start',
                  alignItems: 'flex-start',
                  backgroundColor: '#a00',
                }}
                padding={{ top: 80, bottom: 10, left: 0 }}
              >
                
                  <VictoryBar
                    alignment="start"
                    height={40}
                    barWidth={38}
                    domain={{ x: [0, 3], y: [0, maxCtLtLtaChart] }}
                    cornerRadius={{ topLeft: 5, topRight: 5 }}
                    data={[wantedGraphicDataDeployCt[0]]}
                    events={[
                      {
                        target: 'data',
                        eventHandlers: {
                          onPressIn: () => {
                            return [
                              {
                                target: 'data',
                                mutation: dataProps => {
                                  return {};
                                },
                              },
                            ];
                          },
                        },
                      },
                    ]}
                    labels={() => null}
                  />
                
              </VictoryStack>

我尝试向VictoryBar添加range属性,但仍然出现相同的错误。有人能否请告诉我问题出在哪里?我不知道为什么会出现这个错误!

英文:

I'm using Victory Bar with React native, and I'm VERY confused with what's happening. I'm receiving the following error:

Warning: Failed prop type: Invalid prop `range` supplied to `VictoryBar`.
at VictoryBar
in VictoryStackBase (created by VictoryStack)

I have the following code:

<VictoryStack
horizontal={true}
width={310}
height={90}
alignment="start"
colorScale={graphicColorDeploy}
style={{
justifyContent: 'flex-start',
alignItems: 'flex-start',
backgroundColor: '#a00',
}}
padding={{ top: 80, bottom: 10, left: 0 }}
>
<VictoryBar
alignment="start"
height={40}
barWidth={38}
domain={{ x: [0, 3], y: [0, maxCtLtLtaChart] }}
cornerRadius={{ topLeft: 5, topRight: 5 }}
data={[wantedGraphicDataDeployCt[0]]}
events={[
{
target: 'data',
eventHandlers: {
onPressIn: () => {
return [
{
target: 'data',
mutation: dataProps => {
return {};
},
},
];
},
},
},
]}
labels={() => null}
/>
</VictoryStack>

I tried adding the property range to VictoryBar, but the same Erroe appeared again.
Can someone PLEASE give me an idea of the problem here? I have no idea why I'm getting the error!

答案1

得分: 1

我通过添加一个 right: 1 的填充属性来解决了这个问题。

英文:

I've solved this by adding a right: 1 padding prop.

huangapple
  • 本文由 发表于 2023年4月17日 07:21:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/76030783.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定