kizitonwose / Calendar

A highly customizable calendar view and compose library for Android and Kotlin Multiplatform.
MIT License
4.76k stars 509 forks source link

Throw `AbstractMethodError` when scrolling calendar #453

Closed dylan-kwon closed 1 year ago

dylan-kwon commented 1 year ago

Library information:

Describe the bug**

java.lang.AbstractMethodError: abstract method "float androidx.compose.foundation.gestures.snapping.SnapLayoutInfoProvider.calculateSnapStepSize(androidx.compose.ui.unit.Density)"

To Reproduce (if applicable)

Steps to reproduce the behavior:

  1. Just scroll to next or prev month.

It works normally in versions below 2.1.1.

kizitonwose commented 1 year ago

What version of compose do you have?

dylan-kwon commented 1 year ago

compose.compiler 1.4.3 material3 1.1.0-alpha08 etc 1.4.0-rc01

kizitonwose commented 1 year ago

etc 1.4.0-rc01

I assume this is compose UI?

dylan-kwon commented 1 year ago

yes

Do you need sample code?

kizitonwose commented 1 year ago

That would be great, thanks. Although compose 1.4 isn't officially supported yet.

dylan-kwon commented 1 year ago

thank you Are there any plans or timelines for compose 1.4 support?

arijit4 commented 1 year ago

@dylan-kwon did you find any workaround? I'm also facing this issue. I upgraded my compose version to 1.4.1 and this happened.

kizitonwose commented 1 year ago

I bumped compose UI to 1.4 in this branch but could not reproduce this crash, could someone provide more info regarding usage/calendar setup etc.

arijit4 commented 1 year ago

@kizitonwose I'm using a HorizontalCalender which is showing 12 months. 1st month is rendered fine. As soon as I scroll to the 2nd month, the app crashes and logs the error @dylan-kwon has mentioned.

I don't know how you are implementing the pagination for the calendars. But in Compose 1.4+, Paging is supported by compose itself (though it's experimental). Maybe, this just fixes this issue completely.

kizitonwose commented 1 year ago

This is now fixed in the latest library snapshot. Please use the snapshot and check that it works as expected.

Snapshot url: maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' } Snapshot artifact: implementation 'com.kizitonwose.calendar:compose:2.2.1-SNAPSHOT'

I will release it this week.

dylan-kwon commented 1 year ago

@kizitonwose I use this snapshot version and the problem is solved.

arijit4 commented 1 year ago

@kizitonwose I have one more suggestion if you can make it work. What if the calender is snapped to the middle of screen, not to the start?

kizitonwose commented 1 year ago

@arijit4 In future versions, it should be possible to customize the snap behavior. Hoping to ship it after the coming release.

kizitonwose commented 1 year ago

Version 2.3.0 is now released with the fix.