thegamenicorus / react-native-timeline-listview

Timeline component for React Native App
https://www.npmjs.com/package/react-native-timeline-listview
MIT License
1.17k stars 184 forks source link

Warning: In next release empty section headers will be rendered. #38

Open neogeno opened 6 years ago

neogeno commented 6 years ago

With latest version of React Native 0.55 this yellow box appears.

Ahagan commented 6 years ago

I receive this too and I am using react 0.55 as well. Previously, the timeline rendered fine.

Visually, it doesn't render at all and get the following message:

Stack strace:

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

Ahagan commented 6 years ago

@neogeno, how was you passing data to the 'data' prop? Previously I passed it a function which mapped my data into the structure required by the component.

I have since moved that logic out to a separate function and invoked it and works fine for me now without the warning messages.

Old way that no longer works for me: <Timeline data={() => { return [{ title: 'example', description: 'example }] }} />

Extracted way which works:

`` getData() { return [{ title: 'example', description: 'example }] } render() {

} ``

alz10 commented 6 years ago

UPDATE: The easiest way is to use options.

<Timeline options={{ enableEmptySections: true }} />

===================================================================

In your project folder find node_modules and then scroll down to find react-native-timeline-listview open that folder and find lib open that too and click on index.js

On the render() find the code below and put enableEmptySections. Check documentation here React-Native ListView

        <ListView
          enableEmptySections
          ref="listView"
          style={[styles.listview, this.props.listViewStyle]}
          dataSource={this.state.dataSource}
          renderRow={this._renderRow}
          showsHorizontalScrollIndicator={false}
          showsVerticalScrollIndicator={false}
          automaticallyAdjustContentInsets={false}
          {...this.props.options}
        />

After that the yellow warning will be gone