React native onClick事件在Victory Pie上不起作用 { 返回[ { 目标:“数据”, 突变:(道具)=>{ console.log('index:'+props.index); 返回null; } }, { 目标:“标签”, 突变:(道具)=>{ console.log('text:'+props.text); 返回null; } } ]; } } }]}/>

React native onClick事件在Victory Pie上不起作用 { 返回[ { 目标:“数据”, 突变:(道具)=>{ console.log('index:'+props.index); 返回null; } }, { 目标:“标签”, 突变:(道具)=>{ console.log('text:'+props.text); 返回null; } } ]; } } }]}/>,react-native,victory-charts,React Native,Victory Charts,我在Victory Pie中使用了standalone={false},因为它在svg下,正如github中Victory图表问题中的许多人所建议的那样,但没有用,它不会触发任何事件。它在ios和android中都不起作用。请帮助我我在事件处理程序中找到了一个答案,用onPressIn替换onClick{ <View style={styles.chart}}} > <Svg height={400} width={400}> <Vict

我在Victory Pie中使用了standalone={false},因为它在svg下,正如github中Victory图表问题中的许多人所建议的那样,但没有用,它不会触发任何事件。它在ios和android中都不起作用。请帮助我

我在事件处理程序中找到了一个答案,用onPressIn替换onClick

{
<View
    style={styles.chart}}} >
    <Svg height={400} width={400}>
      <VictoryPie
        colorScale={["#00897B", "#7fc4bd", "#b70104" ]}
        innerRadius={90}
        style={{
          labels: {
            fontSize: 18, fill: "#ffffff"
          }
        }}
        animate={{ duration: 1500 }}
        data={this.state.data}
        padding={{ top: 0, bottom: 35, right:10, left:10 }}
        labelRadius={100}
        standalone={false}
        width={400}
        height={400}
        events={[{
          target: "data",
          eventHandlers: {
            onClick: () => {
              return [
                {
                  target: "data",
                  mutation: (props) => {
                    console.log('index: '+props.index);
                    return null;
                  }
                }, {
                  target: "labels",
                  mutation: (props) => {
                    console.log('text: '+props.text);
                    return null;
                  }
                }
              ];
            }
          }
        }]}/>
      <VictoryLabel
        x={200} y={200}
        textAnchor="middle"
        style={{ fontSize: 23,fill: 'white'}}
        text="Total Revenue"/>
    </Svg>
</View>
返回[ { 目标:“数据”, 突变:dataProps=>{ console.log('所选项目为',dataProps.index) 返回{} } } ] }, onPressOut:()=>{ } } } ]} />
    <VictoryPie
          data={array}
          width={350}
          height={350}
          innerRadius={95}
          colorScale={["#00897B", "#7fc4bd", "#b70104" ]}
          events={[
            {
              target: 'data',
              eventHandlers: {
                onPressIn: () => {
                  return [
                    {
                      target: 'data',
                      mutation: dataProps => {
                          console.log('item selected is',dataProps.index)
                            return {}
                      }
                    }
                  ]
                },
                onPressOut: () => {
                }
              }
            }
          ]}
     />