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

Can't scroll year in Date selection #11

Open
rahul260792 opened this issue Dec 11, 2019 · 14 comments
Open

Can't scroll year in Date selection #11

rahul260792 opened this issue Dec 11, 2019 · 14 comments
Assignees
Labels

Comments

@rahul260792
Copy link

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

@KlausNie
Copy link
Member

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

@KlausNie
Copy link
Member

KlausNie commented Jan 7, 2020

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
Copy link
Member

KlausNie commented Jan 9, 2020

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

@KlausNie
Copy link
Member

KlausNie commented Jan 9, 2020

@KlausNie
Copy link
Member

KlausNie commented Jan 9, 2020

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

@rahul260792
Copy link
Author

@KlausNie I found this on real device.

@KlausNie
Copy link
Member

KlausNie commented Jan 9, 2020

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.

@IHNEL
Copy link

IHNEL commented Feb 4, 2020

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

@KlausNie KlausNie self-assigned this Feb 5, 2020
@KlausNie
Copy link
Member

KlausNie commented Feb 5, 2020

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.

@IHNEL
Copy link

IHNEL commented Feb 6, 2020

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.

@KlausNie
Copy link
Member

KlausNie commented Feb 6, 2020

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?

@zhubinsheng
Copy link

Any updates? Encountered this problem on multiple mobile phones

@zhubinsheng
Copy link

#32 (comment)
this work good on android 10 emulator with 300px X 300px

@zhubinsheng
Copy link

work fail on 200px X 250px

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants