Code Monkey home page Code Monkey logo

Comments (10)

naqvitalha avatar naqvitalha commented on May 28, 2024

initialRenderIndex only works with initial mount. That's the way it was designed. I think you can easily achieve your case by using scrollToIndex. initialRenderIndex is helpful in cases of initial mount where you don't want any flickers.

from recyclerlistview.

AbdallaElabd avatar AbdallaElabd commented on May 28, 2024

How about that other problem that I'm showing in my snack, where the scroll position is maintained when the over all height of the all rows is smaller?

from recyclerlistview.

naqvitalha avatar naqvitalha commented on May 28, 2024

I'm not able to repro that. Any hints?

from recyclerlistview.

AbdallaElabd avatar AbdallaElabd commented on May 28, 2024

I just noticed that it's working on my android phone but not on the iPhone simulator. Load the snack and you'll see that it loads a 100 rows with an initial render index of 20. Tap on "Change Rows" which change the content to 10 rows. You'll notice that the scroll position is way below the last item in the list. If you touch the RecyclerListView, it will scroll up to the last item of the list.

from recyclerlistview.

naqvitalha avatar naqvitalha commented on May 28, 2024

That explains why it wasn't happening for me on android. I really wouldn't want to put a hack to fix it for iOS. Btw does an extra setState fixes it? How about a programmatic one pixel scroll?

from recyclerlistview.

AbdallaElabd avatar AbdallaElabd commented on May 28, 2024

Programmatic scrolling doesn't work, I'm afraid. I even tried getCurrentScrollOffset() and it's returning the wrong offset. Looks like the height of the listview is being updated on scroll or something.

Another setState just update the rows, but the scroll position is never updated until you manually scroll inside of the listview.

Check out this example where I'm changing rows from 100 to 25, with an initialRenderIndex of 20.
https://snack.expo.io/HJc3h02kM

from recyclerlistview.

naqvitalha avatar naqvitalha commented on May 28, 2024

Data Provider change immediately causes a change in height since a request layout immediately happens in the layout manager. This seems to be an iOS thing. I don't have time to look into this right now. Will appreciate if you can dig deep otherwise, I'll come back to this later.

from recyclerlistview.

AbdallaElabd avatar AbdallaElabd commented on May 28, 2024

A little bit of a late reply, but I've just had the same problem with the normal ScrollView on iOS. React native doesn't update the scroll position when the content of the scroll view change and it becomes smaller. Just thought I'd share this obvious observation.

from recyclerlistview.

naqvitalha avatar naqvitalha commented on May 28, 2024

Thanks for the update! Did you raise an issue with RN? If you did reference it here.. I might ask our iOS team to look into the RN issue

from recyclerlistview.

naqvitalha avatar naqvitalha commented on May 28, 2024

Closing dude to lack of activity.

from recyclerlistview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.