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

Does not work with DiffUtill #28

Open
Stashevskiy opened this issue Nov 19, 2020 · 1 comment
Open

Does not work with DiffUtill #28

Stashevskiy opened this issue Nov 19, 2020 · 1 comment
Labels
question Further information is requested

Comments

@Stashevskiy
Copy link

Hello, I found that library does not work with DiffUtill. When a new list is added, it will scroll to the first position. Сould you fix this?

@ajans
Copy link

ajans commented Jan 18, 2021

I don't think this has anything to do with DiffUtil.
Try this before you set the adapter to the recyclerview:

In Kotlin:

        adapter.stateRestorationPolicy =
            RecyclerView.Adapter.StateRestorationPolicy.PREVENT_WHEN_EMPTY

In java:

        adapter.setStateRestorationPolicy(RecyclerView.Adapter.StateRestorationPolicy.PREVENT_WHEN_EMPTY);

If you get a compilation error, try updating the recyclerview-dependency to current version:

        implementation "androidx.recyclerview:recyclerview:1.2.0-beta01"

@Faltenreich Faltenreich added the question Further information is requested label Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants