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 not switch page if switch tab when data is large! #2

Open
thanhluantl2304 opened this issue Nov 27, 2019 · 4 comments
Open

Can not switch page if switch tab when data is large! #2

thanhluantl2304 opened this issue Nov 27, 2019 · 4 comments

Comments

@thanhluantl2304
Copy link

If one section's data is too large, I can't switch to other tab's page.
Any one can help me about that problem?

@markrickert
Copy link

I'm running into this issue as well. Turns out that <SectionList> does some lazy loading and we have to account for it. I found that implementing this library and adjusting the heights of things to meet my needs resolved my problem:

https://www.npmjs.com/package/react-native-section-list-get-item-layout

This happens when the list is too long and you tap a tab for a section that's not loaded. I'd also recommend adding this to your sectionlist to prevent crashes from this:

    <SectionList
      onScrollToIndexFailed={() => { }}
      {...}
    />

@cristaken
Copy link

I'm running into this issue as well. Turns out that <SectionList> does some lazy loading and we have to account for it. I found that implementing this library and adjusting the heights of things to meet my needs resolved my problem:

https://www.npmjs.com/package/react-native-section-list-get-item-layout

This happens when the list is too long and you tap a tab for a section that's not loaded. I'd also recommend adding this to your sectionlist to prevent crashes from this:

    <SectionList
      onScrollToIndexFailed={() => { }}
      {...}
    />

I researched through this npm library but without make it works yet, can you explain or put a example here please?

My problem is explained here: https://stackoverflow.com/questions/62942569/how-to-configure-getitemlayout-prop-for-sectionlist-with-dynamic-height

@butri71
Copy link

butri71 commented Nov 8, 2023

Has anyone ever found any solution yet?

@DhrupalRafaliya
Copy link

DhrupalRafaliya commented Jan 30, 2024

Add the length of your list here and the issue will be solved and the length will be

const length=data&&data?.flatMap(item=>item?.dish_detail).length+data?.length*2

initialNumToRender={length}
maxToRenderPerBatch={length} 

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

No branches or pull requests

5 participants