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

[#600] Avoid gesture-related modifier if gestures are disabled #707

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from

Conversation

peposdd
Copy link

@peposdd peposdd commented Jun 9, 2024

Description

Fixes #600

The .onPointerEvent modifier applied to the parent Box of the container was always active, even when isGesturesEnabled was set to false. This caused unnecessary interception of gestures, preventing them from properly propagating up the view tree.

The fix is conditionally applying the .onPointerEvent modifier only when isGesturesEnabled is true. This ensures that gestures are intercepted only when necessary, allowing them to propagate correctly when gestures are disabled.

Checklist

  • I've updated CHANGELOG.md if required.
  • I've updated the documentation if required.

Comment on lines +116 to 119
.then(if (!appyxComponent.isGesturesEnabled) Modifier else Modifier.onPointerEvent {
if (it.type == PointerEventType.Release) {
appyxComponent.onRelease()
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @peposdd thanks for the PR! Looks good, one suggestion: a statement without (!) is easier to read

Suggested change
.then(if (!appyxComponent.isGesturesEnabled) Modifier else Modifier.onPointerEvent {
if (it.type == PointerEventType.Release) {
appyxComponent.onRelease()
}
.then(if (appyxComponent.isGesturesEnabled) {
Modifier.onPointerEvent {
if (it.type == PointerEventType.Release) {
appyxComponent.onRelease()
} else {
Modifier
}

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

Successfully merging this pull request may close these issues.

Parent interaction is gone once it has a child on top
2 participants