victory icon indicating copy to clipboard operation
victory copied to clipboard

Keeping the tooltip active onPressOut while still supporting scrubbing

Open noman-ahmad opened this issue 3 years ago • 1 comments

Background

  • We are using Victory Native to render a bar chart, and we are having some issues implementing tooltips.
  • Our desired behavior is to be able to scrub across the bars and have the associated tooltip appear
  • We also would like the tooltip to stay visible after the user removes their finger
  • We are passing a custom dataComponent to VictoryBar in order to style the bars with a gradient background

Attempted solutions

  • To get the tooltip to stay active after the user lifts their finger, we used a VoronoiContainer and added a custom event handler for onPressOut where we set the tooltip to active. However, there seems to be a default behavior that closes the tooltip onPressOut, and adding our custom event handler appears to cause a race condition where the tooltip sometimes stays active and sometimes closes, depending on whether or not the default behavior occurs first.

  • We attempted to use event.preventDefault() to disable this default behavior, but it appears to have no effect.

  • We also tried to add additional event handlers for touch events (such as onTouchEnd) but they do not appear to be triggered at all.

  • We tried experimenting with onPressIn and onPress, but when we returned any handler for those events, it would disable the scrubbing behavior

Is there a recommended approach for keeping the tooltip active while still supporting the scrubbing behavior? Any advice would be greatly appreciated!

noman-ahmad avatar Jun 09 '22 16:06 noman-ahmad

@noman-ahmad Did you make any progress on this?

mattmcdev avatar Jul 22 '22 15:07 mattmcdev

This issue is stale because it has been open for 90 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

github-actions[bot] avatar Mar 02 '24 00:03 github-actions[bot]

This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.

github-actions[bot] avatar Mar 09 '24 01:03 github-actions[bot]