RN-435 Fixed Loading messages... message not appearing (#1104)

* RN-435 Fixed Loading Messages... message not appearing

* Made capitalization of Loading messages... more consistent

* Fixed ignored eslint warning

* Removed outdated FIXME comment

* Removed unnecessary view
This commit is contained in:
Harrison Healey 2017-11-08 13:55:11 -05:00 committed by enahum
parent cde5984aed
commit 58efa5863b
4 changed files with 30 additions and 23 deletions

View file

@ -0,0 +1,14 @@
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import {connect} from 'react-redux';
import LoadMorePosts from './load_more_posts';
function mapStateToProps(state, ownProps) {
return {
loading: Boolean(state.views.channel.loadingPosts[ownProps.channelId])
};
}
export default connect(mapStateToProps)(LoadMorePosts);

View file

@ -2,7 +2,6 @@
// See License.txt for license information.
import React, {PureComponent} from 'react';
import {connect} from 'react-redux';
import PropTypes from 'prop-types';
import {
TouchableOpacity,
@ -14,8 +13,9 @@ import {makeStyleSheetFromTheme} from 'app/utils/theme';
import FormattedText from 'app/components/formatted_text';
class LoadMorePosts extends PureComponent {
export default class LoadMorePosts extends PureComponent {
static propTypes = {
channelId: PropTypes.string.isRequired, // eslint-disable-line react/no-unused-prop-types
loading: PropTypes.bool.isRequired,
loadMore: PropTypes.func,
theme: PropTypes.object.isRequired,
@ -32,10 +32,12 @@ class LoadMorePosts extends PureComponent {
renderText(style) {
let i18nId = 'posts_view.loadMore';
let defaultMessage = 'Load more messages';
if (this.props.loading) {
i18nId = 'mobile.loading_posts';
defaultMessage = 'Loading Messages...';
defaultMessage = 'Loading messages...';
}
return (
<FormattedText
id={i18nId}
@ -73,11 +75,3 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => {
}
};
});
function mapStateToProps(state, ownProps) {
return {
loading: state.views.channel.loadingPosts[ownProps.channelId] || false
};
}
export default connect(mapStateToProps)(LoadMorePosts);

View file

@ -3,10 +3,7 @@
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet,
View
} from 'react-native';
import {StyleSheet} from 'react-native';
import ChannelIntro from 'app/components/channel_intro';
import FlatList from 'app/components/inverted_flat_list';
@ -162,18 +159,20 @@ export default class PostList extends PureComponent {
};
renderFooter = () => {
if (!this.props.channelId) {
return null;
}
if (this.props.showLoadMore) {
return <LoadMorePosts theme={this.props.theme}/>;
} else if (this.props.channelId) {
// FIXME: Only show the channel intro when we are at the very start of the channel
return (
<View>
<ChannelIntro navigator={this.props.navigator}/>
</View>
<LoadMorePosts
channelId={this.props.channelId}
theme={this.props.theme}
/>
);
}
return null;
return <ChannelIntro navigator={this.props.navigator}/>;
};
render() {

View file

@ -1966,7 +1966,7 @@
"mobile.join_channel.error": "We couldn't join the channel {displayName}. Please check your connection and try again.",
"mobile.loading_channels": "Loading Channels...",
"mobile.loading_members": "Loading Members...",
"mobile.loading_posts": "Loading Messages...",
"mobile.loading_posts": "Loading messages...",
"mobile.login_options.choose_title": "Choose your login method",
"mobile.managed.blocked_by": "Blocked by {vendor}",
"mobile.managed.exit": "Exit",