React-native-gifted-chat: Why is returning an empty view if the message array is empty?

Created on 13 Aug 2018  路  3Comments  路  Source: FaridSafi/react-native-gifted-chat

Why is this done instead of implementing ListEmptyComponent on the FlatList? Any special reason for it?

render() {
    if (this.props.messages.length === 0) {
      return <View style={styles.container} />;
    }
//...

RN docs: https://facebook.github.io/react-native/docs/flatlist#listemptycomponent
https://github.com/FaridSafi/react-native-gifted-chat/blob/master/src/MessageContainer.js#L121

wontfix

Most helpful comment

Reopening this - this seems really bad and isn't documented. Breaks the fact that this is just a listview.

All 3 comments

i think is because this way is easier to handle.
But if you set refresh or load more function in the List, this coding seems cant do that.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Reopening this - this seems really bad and isn't documented. Breaks the fact that this is just a listview.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

audiolion picture audiolion  路  3Comments

Fr33maan picture Fr33maan  路  3Comments

cerberusv2px picture cerberusv2px  路  3Comments

luisfuertes picture luisfuertes  路  3Comments

tafelito picture tafelito  路  3Comments