Victory: Capture onClick / onPress anywhere in a VictoryChart

Created on 7 Jul 2018  路  4Comments  路  Source: FormidableLabs/victory

Bugs and Questions

Checklist

  • [x] This is not a victory-native specific issue. (Issues that only appear in victory-native should be opened here)

  • [x] I have read through the FAQ and Guides before asking a question

  • [x] I am using the latest version of Victory

  • [x] I've searched open issues to make sure I'm not opening a duplicate issue

The Problem

Simple question but I couldn't find an answer in the docs: how can I capture an onClick / onPress anywhere inside a VictoryChart? Struggling with putting events all over the place.

Most helpful comment

@boygirl I confirmed this works on web but not on victory-native with onPress or onPressIn. Any ideas?

All 4 comments

@devth If you want your onClick event to trigger from anywhere on the chart, you should attach you event to the "parent" target. You can read more about the events prop here: https://formidable.com/open-source/victory/docs/common-props/#events. I'm going to close this issue, but please let me know if you are still stuck.

@boygirl I confirmed this works on web but not on victory-native with onPress or onPressIn. Any ideas?

onPressIn cannot work on "victory-native": "^35.0.1",

Was this page helpful?
0 / 5 - 0 ratings