Flipkart / recyclerlistview

High performance listview for React Native and web!
Apache License 2.0
5.21k stars 426 forks source link

Scroll automatically moves when adding new item #680

Open bulz4y opened 2 years ago

bulz4y commented 2 years ago

When i add new item inside RLV scroll automatically moves for amount of that item height. I am using transform: [{scaleY: -1}] and also using dynamic height elements but i am calculating height myself using rnTextSize library. The reason i dont want this scroll to happen is when i am going through older data i dont want anything to interrupt me and this scroll on new item added is bad for UX. Btw i am making chat app.

Can anyone help me ?

thix-tech commented 2 years ago

The same issue I meet now. Does anybody has a solutation about this problem ?

HugoGresse commented 2 weeks ago

I think it's a duplicate of https://github.com/Flipkart/recyclerlistview/issues/37#issuecomment-326746738

Changing the layout provider trigger the nearest top element to be anchored.

A possibility, which is not elegant, is to override the private member of the existing layout provider every time the data changes:

layoutProvider._getLayoutTypeForIndex = (index) => {
            return items[index].type
}