React native 如何在用户按react native中的图表时突出显示条形图

React native 如何在用户按react native中的图表时突出显示条形图,react-native,charts,react-native-svg,react-native-svg-charts,React Native,Charts,React Native Svg,React Native Svg Charts,是否可以使用onPress事件更改条形图的特定条形图颜色或样式 任何人,请帮帮我。你应该尝试将颜色或样式设置为状态,然后在onPress中更改它。然后这些变化就会反映出来: onPress={()=> this.setState({colors: ['#7b4173', '#a55194', '#ce6dbd', '#de9ed6']}) 例如,在StackedBarChart中,插入作为道具: <StackedBarChart style={{ he

是否可以使用onPress事件更改条形图的特定条形图颜色或样式


任何人,请帮帮我。

你应该尝试将颜色或样式设置为状态,然后在onPress中更改它。然后这些变化就会反映出来:

onPress={()=> this.setState({colors: ['#7b4173', '#a55194', '#ce6dbd', '#de9ed6']})
例如,在StackedBarChart中,插入作为道具:

  <StackedBarChart
            style={{ height: 200 }}
            keys={keys}
            colors={this.state.colors}
            data={data}
            showGrid={false}
            contentInset={{ top: 30, bottom: 30 }}
        />

感谢您的回复。我只想更改我按下的特定条的颜色。在条形图上有可能吗?