diff --git a/app/components/custom_list/index.js b/app/components/custom_list/index.js index 9014fe553..713f70599 100644 --- a/app/components/custom_list/index.js +++ b/app/components/custom_list/index.js @@ -3,6 +3,8 @@ import React, {PureComponent} from 'react'; import PropTypes from 'prop-types'; import {ListView, Platform, StyleSheet, Text, View} from 'react-native'; + +import Loading from 'app/components/loading'; import FormattedText from 'app/components/formatted_text'; import {makeStyleSheetFromTheme, changeOpacity} from 'app/utils/theme'; @@ -155,15 +157,33 @@ export default class CustomList extends PureComponent { }; render() { - const style = getStyleFromTheme(this.props.theme); + const { + data, + listInitialSize, + listPageSize, + listScrollRenderAheadDistance, + loading, + onListEndReached, + onListEndReachedThreshold, + showNoResults, + showSections, + theme + } = this.props; + const {dataSource} = this.state; + const style = getStyleFromTheme(theme); let noResults = false; - if (typeof this.props.data === 'object') { - noResults = Object.keys(this.props.data).length === 0; + + if (typeof data === 'object') { + noResults = Object.keys(data).length === 0; } else { - noResults = this.props.data.length === 0; + noResults = data.length === 0; } - if (this.props.showNoResults && !this.props.loading && noResults) { + if (loading) { + return ; + } + + if (showNoResults && noResults) { return ( ); }