victory icon indicating copy to clipboard operation
victory copied to clipboard

onPress event not firing on Android devices (victory-native)

Open Makar8000 opened this issue 1 year ago • 10 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

Victory version

"victory-native": "37.0.2", "react-native-svg": "15.8.0"

Code Sandbox link

https://snack.expo.dev/-8jFnfC69c-pJB3gQJhs_

Bug report

When using a physical Android device, the `onPress` event will not be fired for Victory components. This happens regardless of what containerComponent you use. In the provided snack I have used `VictoryBar` with `VictoryZoomContainer`.

The issue is not reproducible on iOS physical device, iOS simulator, or Android simulator. The issue only appears when running on a physical Android device.

Steps to reproduce

Open the snack link provided, then:
1) Run the app using the Android simulator provided on the right.
2) Tap on any bar.
3) Check console logs. All events will fire as expected.
4) Run the app using the "My Device" and use a physical Android device.
5) Tap on any bar.
6) Check console logs. `onPressIn` will fire as expected, `onPressOut` will fire immediately (unexpected), and `onPress` does not fire at all.

Expected behavior

The onPress event should be fired when user taps on the respective Victory component

Actual behavior

The onPress event does not fire at all. Furthermore, the onPressOut event fires immediately after onPressIn, instead of firing when the user releases a press

Environment

- Device: Android physical devices (tested so far: Pixel 8, Samsung Galaxy S23)
- OS: Android 15
- Node: 20
- npm: 10

Makar8000 avatar Dec 18 '24 21:12 Makar8000

Related: #2131

Makar8000 avatar Dec 18 '24 21:12 Makar8000

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 19 '25 00:03 github-actions[bot]

This is still an issue - bumping so that it doesn't get auto-closed

Makar8000 avatar Mar 19 '25 01:03 Makar8000

Hey @zachhale @Makar8000 Still looking for the solution do we need to update to the newer version because it needs refactoring of the code

TarunBhan avatar Apr 07 '25 06:04 TarunBhan

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 Jul 07 '25 00:07 github-actions[bot]

This is still an issue - bumping so that it doesn't get auto-closed

Makar8000 avatar Jul 07 '25 00:07 Makar8000

Related: #2131

I was having the same problem VictoryPie (I needed each pie slice of a donut chart to be clickable). What worked for me was replacing onPress with onPressIn handler. Some people discussed this partial solution in the issue you you linked but also mentioned that it might not work form some cases.

If your case is similar to mine, I believe it is the best option considering this is a legacy package.

marcus-castanho avatar Aug 02 '25 22:08 marcus-castanho

Related: #2131

I was having the same problem VictoryPie (I needed each pie slice of a donut chart to be clickable). What worked for me was replacing onPress with onPressIn handler. Some people discussed this partial solution in the issue you you linked but also mentioned that it might not work form some cases.

If your case is similar to mine, I believe it is the best option considering this is a legacy package.

I was aware of this, but the problem is that in my use-case we utilize the zoom container for panning. The onPressIn handler triggers when panning which is a problem for us.

Makar8000 avatar Aug 03 '25 08:08 Makar8000

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 Nov 02 '25 00:11 github-actions[bot]

This is still an issue - bumping so that it doesn't get auto-closed

Makar8000 avatar Nov 02 '25 01:11 Makar8000