Giter VIP home page Giter VIP logo

Comments (16)

AbdallaElabd avatar AbdallaElabd commented on August 30, 2024 1

Even if I rendered the RecyclerListView after I load the data. I'd still have to imperatively scroll to the desired index, which will break because of #44. Thanks for the suggestion though.

from recyclerlistview.

peterjuras avatar peterjuras commented on August 30, 2024

I think the following line suffers from the same issue (I also get an exception because this._virtualRenderer is null):

from recyclerlistview.

naqvitalha avatar naqvitalha commented on August 30, 2024

This usually sometimes happens on dev mode where the time to mount is huge. Never saw in prod mode. If you have a fix can you raise a PR otherwise we'll pick it up when we have time available.

from recyclerlistview.

naqvitalha avatar naqvitalha commented on August 30, 2024

And thanks for the feedback, really appreciate it!

from recyclerlistview.

AbdallaElabd avatar AbdallaElabd commented on August 30, 2024

I'm seeing the same error when I try to call scrollToIndex in my componentDidMount lifecycle hook. The problem, as far as I could investigate, is that _initTrackers is not called until _onSizeChanged is called.
@naqvitalha Could you elaborate?

from recyclerlistview.

naqvitalha avatar naqvitalha commented on August 30, 2024

@abdallamohamed You are right, it's not safe to call it in componentDidMount because initialisation might not have happened. But for your specific use case I think you can specify initialRenderIndex. It was designed for such use cases.

from recyclerlistview.

AbdallaElabd avatar AbdallaElabd commented on August 30, 2024

@naqvitalha that was my first approach but because I'm fetching data from an API, the scroll position is lost. That's the same issue here #44

from recyclerlistview.

naqvitalha avatar naqvitalha commented on August 30, 2024

Why don't you render RecyclerListView once you have the data? Get data and create data source post that render RecyclerListView with initialRenderIndex. For initialRenderIndex to work you need data to be present. Anyways, can you elaborate on the use case so that I can assist better?

from recyclerlistview.

naqvitalha avatar naqvitalha commented on August 30, 2024

@peterjuras Have raised a PR to fix this issue #46 . Tested on your sample as well. Can you once go through and verify if it fixes the issues you encountered. We will then publish the package.

from recyclerlistview.

naqvitalha avatar naqvitalha commented on August 30, 2024

@abdallamohamed scrollToIndex will still fail if called before mounting. I believe that's the way it should be and currently we don't have a workaround. I will put a null check though.

from recyclerlistview.

AbdallaElabd avatar AbdallaElabd commented on August 30, 2024

@naqvitalha Yeah. I put a setTimeout as a workaround. I think it all comes to maintaining the scroll position as new items are added to the list. Then there would be no need to call scrollToIndex, because we already haveinitialRenderIndex

from recyclerlistview.

naqvitalha avatar naqvitalha commented on August 30, 2024

@abdallamohamed Interested in seeing what you're building. Anyway to take a look?

from recyclerlistview.

naqvitalha avatar naqvitalha commented on August 30, 2024

Fixed in #46

from recyclerlistview.

peterjuras avatar peterjuras commented on August 30, 2024

Sorry for the late response, I can confirm that the fix resolves the issue.

However, you should check out #47 since it might affect new users.

from recyclerlistview.

AbdallaElabd avatar AbdallaElabd commented on August 30, 2024

@naqvitalha can you share your email so I could share the details with you? I tried sending an email to [email protected] but Gmail fails to deliver my mails.

from recyclerlistview.

naqvitalha avatar naqvitalha commented on August 30, 2024

[email protected] is public now... it should be working... can you try now? If it doesn't please DM me on twitter.. I'll pass on the email there.

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.