SurveyKit icon indicating copy to clipboard operation
SurveyKit copied to clipboard

Can't scroll year in Date selection

Open rahul260792 opened this issue 4 years ago • 14 comments

I implemented date selection but can't scroll the year selection in date selector

rahul260792 avatar Dec 11 '19 09:12 rahul260792

This seems to be an issue with nestedScrolling. I started a fix, but I'm not yet done.

KlausNie avatar Dec 19 '19 10:12 KlausNie

This seems to be a harder problem than expected. The NumberPicker used in the android.widget.DatePicker does not support nested scrolling. So if the screen is too small for the datepicker and it has to scroll, the year selection just does not work. I've tried to use MaterialDatePicker from com.google.android.material.datepicker.MaterialDatePicker ( https://github.com/material-components/material-components-android/blob/master/docs/components/Picker.md )but that is using Fragments, which I'm not using at all.

The next best thing I'll try to do is replace the DatePicker with a view that shows the selected date and on click I'll just open the DatePickerDialog which does not have this problem at all.

In my opinion it's not as pretty as having the date picker inline, but there is no way around.

KlausNie avatar Jan 07 '20 08:01 KlausNie

Also doesn't work with the dialog on a small enough phone: https://github.com/quickbirdstudios/SurveyKit/tree/feature/date-picker-scroll-issue

KlausNie avatar Jan 09 '20 06:01 KlausNie

Bug report: https://issuetracker.google.com/issues/115395128

KlausNie avatar Jan 09 '20 06:01 KlausNie

@rahul260792 Did you find this on an emulator or on real device?

KlausNie avatar Jan 09 '20 07:01 KlausNie

@KlausNie I found this on real device.

rahul260792 avatar Jan 09 '20 07:01 rahul260792

What I found out is, that if the screen resolution is small, but the API level is 28+, this occurs. The issue at google is closed at the moment on google's side. I'l wait for a change there. Until then this issue is on hold.

KlausNie avatar Jan 09 '20 09:01 KlausNie

I got the same problem on Huawei Nova 3i, which is not small. Will you fix this issue @KlausNie

IHNEL avatar Feb 04 '20 03:02 IHNEL

The issue is: on phones where the screen is small enough so that the NumberPicker has to scroll, the number picker itself scrolls, but not the content. This happens in the dialog as well as in the inline DatePicker. Currently, I have not found a way to fix this. My next options will be to try to find a library that does not have this issue.

KlausNie avatar Feb 05 '20 08:02 KlausNie

Not quite sure about the root cause but I didn't use dialog in the survey. (Does this lib use dialog behind?) When I move the datepicker out of SurveyView, it works fine and I can scroll. I think there is sth wrong with the height of DatePicker view inside SurveyView.

IHNEL avatar Feb 06 '20 09:02 IHNEL

I thought so too, but then I tried the DatePickerDialog in the SurveyView and I had the same issue. How can the SurveyView impact that?

KlausNie avatar Feb 06 '20 19:02 KlausNie

Any updates? Encountered this problem on multiple mobile phones

zhubinsheng avatar Oct 13 '21 11:10 zhubinsheng

https://github.com/quickbirdstudios/SurveyKit/pull/32#issue-640536753 this work good on android 10 emulator with 300px X 300px

zhubinsheng avatar Oct 15 '21 06:10 zhubinsheng

work fail on 200px X 250px

zhubinsheng avatar Oct 15 '21 06:10 zhubinsheng