airbnb / HorizonCalendar

A declarative, performant, iOS calendar UI component that supports use cases ranging from simple date pickers all the way up to fully-featured calendar apps.
Apache License 2.0
2.79k stars 234 forks source link

Request: Disable User Interaction For Scrolling #86

Open zachterrell57 opened 3 years ago

zachterrell57 commented 3 years ago

Hello everyone,

This calendar is still great, really loving the ease of use that comes with it! One request that I have for a specific use case is to disable user-interaction for scrolling. In this scenario, the only way to scroll the calendar would be via button press. Would it be possible to implement the option to disable this scrolling behavior? I should add that my calendar is oriented in the horizontal position.

Thanks!

bryankeller commented 3 years ago

Hey Zach,

Thinking through the API a bit: I think we'll want to make this a configurable property on CalendarViewContent. I'm wondering if this option makes sense for vertical and horizontal calendars, or if the UX really only makes sense for horizontal calendars. It seems really non-standard to have a vertical-layout calendar that can't be scrolled with a finger (and would instead rely on up / down arrows to manually paginate). I see the use-case for horizontal calendars, though. What do you think?

saudeon commented 3 years ago

@bryankeller I do think this is more for a use-case for horizontal calendars (and could tie neatly into the work you're doing for pagination vs free scrolling) if I can chime in!

zachterrell57 commented 3 years ago

I agree with both of you, I think this is a feature mainly for horizontally-scrolling calendars. I do think the combination of this behavior plus the pagination feature would unlock a ton of additional use cases, as @saudeon mentioned.

The provided mockup is the only use-case I could see the vertical pagination being useful for. An additional one that I didn't create would be if there was a calendar embedded in something like a UICollectionView, where the act of vertically scrolling was already being used. However, I can't imagine a real world scenario in which someone does this.

image

bryankeller commented 3 years ago

Nice, thanks for the example @zachterrell57. I definitely see how this could apply to vertically-scrolling calendars, but I find that UX to be particularly non-standard for a native iOS app, so I'm leaning toward not allowing it to discourage people from doing the wrong thing 😝

Edit: Just saw your example of it being embedded in a vertically-scrolling collection view cell - in this case, I think the correct UX would be to have a horizontally-scrolling calendar embedded in the cell.

zachterrell57 commented 3 years ago

@bryankeller

Totally agree. I was kinda of grasping at straws to find a vertical use case 😆. So would you only allow this behavior in the .horizontal mode then?

bryankeller commented 3 years ago

Yes, I think this should only be a feature of the horizontal-use-case. As a temporary workaround, you can disable scrolling on calendarView.subviews[0], and implement your button press functionality by calling scrollToMonth. I don't have near-term plans to start work on this as part of the API, but hopefully this hacky workaround can unblock you.

jl-mobitech commented 9 months ago

Yes, I think this should only be a feature of the horizontal-use-case. As a temporary workaround, you can disable scrolling on calendarView.subviews[0], and implement your button press functionality by calling scrollToMonth. I don't have near-term plans to start work on this as part of the API, but hopefully this hacky workaround can unblock you.

@bryankeller, I'm quite bit lost but how can we disable the scrolling of horizontal calendar using calendarView.subviews[0] that you mentioned?

jonathansds commented 1 month ago

Is there any workaround or estimate on when this will be available for SwiftUI implementation?