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

React Native 0.23.1 warning: 'In next release empty section headers will be rendered' #39

Open
benvium opened this issue Apr 14, 2016 · 7 comments

Comments

@benvium
Copy link

benvium commented Apr 14, 2016

Since upgrading I'm now getting this error.

My setup looks like this:

<GiftedListView style={{flex:1}}
                                automaticallyAdjustContentInsets={false}
                                rowView={this._renderRow}
                                onFetch={this._loadDataFromNetwork}
                                firstLoader={true}
                                pagination={false}
                                refreshable={true}
                                withSections={false}
                                customStyles={{refreshableView:{backgroundColor: '#FFFFFF'}}}
                                emptyView={this._renderEmptyView}
                                ref="listView"

                />

e.g. I'm using withSections={false}. Any ideas?

@jeromegrosse
Copy link

The full error message is: Warning: In next release empty section headers will be rendered. In this release you can use 'enableEmptySections' flag to render empty section headers.

This flag is referenced in the documentation of the ListView. I'm not sure how @FaridSafi would like to solve the issue, but currently it is possible to mute the error passing it the flag, knowing that at some point the flag will be deprecated. Anyways @benvium, as a temporary fix insert the following line while calling GiftedListView: enableEmptySections={true}.

@benvium
Copy link
Author

benvium commented Apr 15, 2016

Thanks @jeromegrosse, that works, at least until the next version of React Native.

@faceyspacey
Copy link

in the next release, we're supposed to exclude the indices from the sectionID object:

https://facebook.github.io/react-native/docs/listview.html#enableemptysections

But what does that mean? Where will we exclude the indices? Where is the sectionID object? I don't see it in the source code.

@eremzeit
Copy link

eremzeit commented May 5, 2016

If empty sections are not desired to be rendered their indices should be excluded from sectionID object.

AFAIK, this is just a confusing way of saying that in the future if you don't want the headers for empty sections to show up, don't include that sectionId in the data blob you passed to cloneWithRowsAndSections. If you use cloneWithRows then you don't have sections and so there's no issue with section headers showing up. The confusing part is that even if you don't use sections, it will still throw the warning mentioning sections. In this case, you can just set enableEmptySections={true} and forget about it.

https://github.com/facebook/react-native/blob/master/Libraries/CustomComponents/ListView/ListViewDataSource.js
http://moduscreate.com/react-native-listview-with-section-headers/

@dalvik31
Copy link

dalvik31 commented Aug 22, 2016

enableEmptySections={true} work for me, thanks #jeromegrosse

wutongke added a commit to wutongke/react-native-one that referenced this issue Oct 7, 2016
zhenwusw added a commit to onepaylabs/react-native-gifted-listview that referenced this issue Aug 12, 2017
lll000111 added a commit to lll000111/react-native-fetch-blob-dev that referenced this issue Aug 15, 2017
@mgarc729
Copy link

I am using the new FlatList and passing that prop didn't work ... maybe it doesn't get pass later to the ListView component. So ... I commented the warning in the ListView.js file located in .../node_modules/react-native/Libraries/Lists/ListView/ListView.js line 433-437. It is not the best solution .. but we know the warning exists and it doesn't pops up anymore. I hope someone finds it useful.

@yelkamel
Copy link

I did like @mgarc729 but clearly if there is better solution, I'm here !

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

7 participants