Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to cancel Tooltip TouchEvent when chart in scrollview #144

Open
NguyenHoangMinhkkkk opened this issue Jan 19, 2024 · 5 comments
Open
Assignees

Comments

@NguyenHoangMinhkkkk
Copy link

When i put <TouchableOpacity /> inside <Scrollview />, the press event can be cancelled when the gesture scroll-out.
But with the <Chart /> inside <Scrollview />, tooltip {trigger: "item"} event in <Chart /> will trigger immediately and show tooltip on press-in, cannot be cancelled

how to cancel tooltip triggered when user gesture scroll out the chart view ?

Screen.Recording.2024-01-19.at.09.57.08.mov
@zhiqingchen
Copy link
Member

@SilentMelody Can the Click trigger logic be optimized?

@NguyenHoangMinhkkkk
Copy link
Author

@SilentMelody Can the Click trigger logic be optimized?

Thanks for reply,
i'm temporary using Scrollview onMomentumScrollBegin, onMomentumScrollEnd and a boolean Ref to prevent triggered event while scrollview is scrolling.

@zhiqingchen
Copy link
Member

The click can be triggered at the end of the gesture, depending on the position (e.g. if it moves more than x pixels).

https://github.com/wuba/react-native-echarts/blob/main/src/components/PanResponderHandler.tsx#L97

https://github.com/wuba/react-native-echarts/blob/main/src/components/RNGestureHandler.tsx#L64

@NguyenHoangMinhkkkk
Copy link
Author

hi there.
in this example, should i use of react-native-gesture-handler instead of default of RN?
or someother way for optimize that behavior ?

@NguyenHoangMinhkkkk
Copy link
Author

src/components/PanResponderHandler.tsx#L97src/components/PanResponderHandler.tsx#L97

patch-package -> add a boolean value "isAvoidPressOnScroll" and everything working good.

onPanResponderGrant: ({ nativeEvent }) => {
    if (isAvoidPressOnScroll) dispatchEvents(['mousedown'], nativeEvent);
    else dispatchEvents(['mousedown', 'mousemove'], nativeEvent);
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants