diff --git a/app/components/post_list_retry.js b/app/components/post_list_retry.js
new file mode 100644
index 000000000..173ffcb84
--- /dev/null
+++ b/app/components/post_list_retry.js
@@ -0,0 +1,83 @@
+// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import React, {PropTypes, PureComponent} from 'react';
+import {
+ Platform,
+ StyleSheet,
+ TouchableOpacity,
+ View
+} from 'react-native';
+import Icon from 'react-native-vector-icons/Ionicons';
+
+import FormattedText from 'app/components/formatted_text';
+import {makeStyleSheetFromTheme} from 'app/utils/theme';
+
+export default class PostListRetry extends PureComponent {
+ static propTypes = {
+ retry: PropTypes.func.isRequired,
+ theme: PropTypes.object.isRequired
+ };
+
+ render() {
+ const {retry, theme} = this.props;
+ const style = getStyleSheet(theme);
+
+ return (
+
+
+
+
+
+
+
+
+ );
+ }
+}
+
+const getStyleSheet = makeStyleSheetFromTheme((theme) => {
+ return StyleSheet.create({
+ buttonContainer: {
+ alignItems: 'center',
+ justifyContent: 'center'
+ },
+ buttonWrapper: {
+ height: 60,
+ width: 60,
+ borderRadius: 30,
+ backgroundColor: '#ddd',
+ alignItems: 'center',
+ justifyContent: 'center',
+ overflow: 'hidden'
+ },
+ container: {
+ flex: 1,
+ alignItems: 'center',
+ justifyContent: 'center'
+ },
+ icon: {
+ color: theme.linkColor,
+ ...Platform.select({
+ ios: {
+ marginTop: 5
+ }
+ })
+ },
+ text: {
+ marginTop: 15,
+ color: theme.linkColor
+ }
+ });
+});
diff --git a/app/scenes/channel/channel_post_list/channel_post_list.js b/app/scenes/channel/channel_post_list/channel_post_list.js
index cfb32f5ae..f2f85a031 100644
--- a/app/scenes/channel/channel_post_list/channel_post_list.js
+++ b/app/scenes/channel/channel_post_list/channel_post_list.js
@@ -12,6 +12,7 @@ import {Constants, RequestStatus} from 'mattermost-redux/constants';
import ChannelLoader from 'app/components/channel_loader';
import PostList from 'app/components/post_list';
+import PostListRetry from 'app/components/post_list_retry';
const {View: AnimatedView} = Animated;
const {height: deviceHeight, width: deviceWidth} = Dimensions.get('window');
@@ -34,7 +35,8 @@ export default class ChannelPostList extends PureComponent {
getPostsSince: PropTypes.object.isRequired
}).isRequired,
posts: PropTypes.array.isRequired,
- theme: PropTypes.object.isRequired
+ theme: PropTypes.object.isRequired,
+ networkOnline: PropTypes.bool.isRequired
};
state = {
@@ -116,15 +118,25 @@ export default class ChannelPostList extends PureComponent {
render() {
const {
+ actions,
applicationInitializing,
channel,
channelIsLoading,
posts,
postsRequests,
- theme
+ theme,
+ networkOnline
} = this.props;
+
let component;
- if (!applicationInitializing && !channelIsLoading && posts && (postsRequests.getPosts.status !== RequestStatus.STARTED || !this.state.didInitialPostsLoad)) {
+ if (!posts.length && channel.total_msg_count > 0 && (postsRequests.getPosts.status === RequestStatus.FAILURE || !networkOnline)) {
+ component = (
+ actions.loadPostsIfNecessary(channel)}
+ theme={theme}
+ />
+ );
+ } else if (!applicationInitializing && !channelIsLoading && posts && (postsRequests.getPosts.status !== RequestStatus.STARTED || !this.state.didInitialPostsLoad)) {
component = (