英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论