Fix logic to determine final state (week view or month view) when releasing gesture. #1344
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When we perform
Gesture scroll from week view, to month view (without releasing gesture), and then back to week view. If we continue to scroll upward, and release the gesture, the resultant final state will be month view. This is an incorrect behavior. User is expecting the final view to be week view.
Gesture scroll from month view, to week view (without releasing gesture), and then back to month view. If we continue to scroll downward, and release the gesture, the resultant final state will be week view. This is an incorrect behavior. User is expecting the final view to be month view.
After fix
From week view, to month view, then back to week view. The final state (week view) is correct. However, you will observe incorrect UI before the gesture is releasing. This is fixed in #1343
From month view, to week view, then back to month view. The final state (month view) is correct. However, you will still observe incorrect UI before the gesture is releasing. This is fixed in #1343
Note
progress
calculation. As I notice the value ofprogress
is not being used insideperformTransition
function. Hence, I just simply pass in -1 constant.translation
is being removed to simplify the code. Our only goal is to find out, whether the current scrolling direction (velocity
) matched with initial intention (translation
) direction. Revert will be performed if they aren't match.scrollingOverflowRevertRequired
is added to handle scrolling "overflow" edge case.Please kindly let me know, if you have any question. Thank you for reviewing.