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

Touch down deselects old date, touch up selects new date; causes unwanted behavior with long tap #1233

Closed
rvirta opened this issue Mar 8, 2020 · 5 comments

Comments

@rvirta
Copy link

rvirta commented Mar 8, 2020

(Required) Version Number: 8.0.2

Description

When long tapping an unselected date, the selected date deselects itself for an instant and then selects itself again. This causes the date selected indicator view to flash off, which doesn't look very good.

Additional Context

It seems that touch down gesture deselects the currently selected date, and touch up selects the new date. This seems to cause the flashing with long taps. Is this intended behavior, and if it is, is there a setting to change it?

calendar
It's hard to see in the video, but in the first part I long tap another cell and the selected cell flashes. In the second part I've disabled the long press recognizer and click down on the new date (previously selected date's indicator disappears), and when I release the click the new date is selected.

I subscribe to isSelected in the cell to set the indicator views:

override var isSelected: Bool {
        didSet {
            if self.isSelected == true {
                daySelectedIndicator.isHidden = false
            } else {
                daySelectedIndicator.isHidden = true
            }}}
@patchthecode
Copy link
Owner

Read problem #2 on this link and let me know if maybe this applies? #553

@rvirta
Copy link
Author

rvirta commented Mar 9, 2020

Thanks, I'll look into it.
If cellState.isSelected is preferred, is there a way to access it from inside the cell's class? I haven't figured that out yet.
Thanks again!

@rvirta
Copy link
Author

rvirta commented Mar 9, 2020

I don't know if there's a better way, but I now pass the cellState on to the cell subclass when setting up, displaying, selecting and deselecting, and subscribe to self.cellState.isSelected in stead of self.isSelected, and it solved the problem.
Thanks!

@patchthecode
Copy link
Owner

@rvirta thats the thing. I have been awaiting input from the community for a better solution for a long time. Still waiting 😅

@patchthecode
Copy link
Owner

glad your problem is fixed however. Will close this.

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

2 participants