-
Notifications
You must be signed in to change notification settings - Fork 93
Fix freeze when scrolling is cancelled during overscroll #1928
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
Conversation
private var overscrollOffset: Offset by mutableStateOf(Offset.Zero) | ||
private var overscrollOffsetState = mutableStateOf(Offset.Zero) | ||
private var overscrollOffset: Offset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will probably be clearer to use an idiomatic approach here:
snapshotFlow { overscrollOffset }
.collect { /* your on change logic */ }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It requires some coroutineContext - but as far as I figured out, it's hard to find one on ini state
) { | ||
if (pass == PointerEventPass.Final) { | ||
if (pointerEvent.type == PointerEventType.Press) { | ||
pointersDown++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we increment on Initial
event pass?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it only triggers recomposition, any phase is sufficient.
...tion/src/uikitMain/kotlin/androidx/compose/foundation/cupertino/CupertinoOverscrollEffect.kt
Show resolved
Hide resolved
override fun onRemeasured(size: IntSize) = onNodeRemeasured(size) | ||
|
||
var pointersDown by mutableStateOf(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it a state? Isn't draw
called without it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change we're looking for has to be triggered by the touch up gesture. If it's not a state - it won't work.
Reset the overscroll effect when no ongoing animation or interaction is applied.
Fixes https://youtrack.jetbrains.com/issue/CMP-7099/iOS-Content-in-a-scrollable-container-becomes-non-focusable-after-calling-focusManager.clearFocus
Release Notes
Fixes - iOS