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

App Crashed when not set sections.data for sectionList #23526

Closed
hweister opened this issue Feb 19, 2019 · 3 comments
Closed

App Crashed when not set sections.data for sectionList #23526

hweister opened this issue Feb 19, 2019 · 3 comments
Labels
Bug Component: SectionList Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@hweister
Copy link

🐛 Bug Report

For SectionList, if user don't set data field for sections property, app will crash.

To Reproduce

Just as described above, set sections=[{data: undefined},{data: undefined}] for SectionList.

Expected Behavior

Either update the document, notice user data is a "must have" key for section define
or update VirtualizedSectionList.js file, check if section.data is defined, before call section.data.length.

@react-native-bot
Copy link
Collaborator

Thanks for submitting your issue. Can you take another look at your description and make sure the issue template has been filled in its entirety?

👉 Click here if you want to take another look at the Bug Report issue template.

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. Resolution: Needs More Information labels Feb 19, 2019
@ericlewis
Copy link
Contributor

@hweister, you must set them to empty arrays instead of undefined. I’m not sure the expected behavior should be to silently fail for misshapen section data, it makes more sense to me to error out in this scenario so you can figure out how it happened. If you prefer it to not crash, ensure you set empty arrays.

@dulmandakh
Copy link
Contributor

I think you should be doing this, if you want to render empty list.

sections=[{data: undefined},{data: undefined}]

@facebook facebook locked as resolved and limited conversation to collaborators Mar 19, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Component: SectionList Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants