Files
mattermost-mobile/app/screens/channel/channel.android.js
Mattermost Build dba3278c9f Automated cherry pick of #4304 (#4306)
* Fix infinite skeleton in different use cases

* Apply suggestions from code review

Co-authored-by: Miguel Alatzar <migbot@users.noreply.github.com>

* Update app/utils/teams.js

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
Co-authored-by: Miguel Alatzar <migbot@users.noreply.github.com>
2020-05-19 16:08:58 -07:00

80 lines
2.4 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import {StyleSheet, View} from 'react-native';
import {openMainSideMenu, openSettingsSideMenu} from '@actions/navigation';
import LocalConfig from '@assets/config';
import KeyboardLayout from '@components/layout/keyboard_layout';
import InteractiveDialogController from '@components/interactive_dialog_controller';
import NetworkIndicator from '@components/network_indicator';
import PostDraft from '@components/post_draft';
import {NavigationTypes} from '@constants';
import EventEmitter from '@mm-redux/utils/event_emitter';
import ChannelNavBar from './channel_nav_bar';
import ChannelPostList from './channel_post_list';
import ChannelBase, {ClientUpgradeListener} from './channel_base';
export default class ChannelAndroid extends ChannelBase {
openMainSidebar = () => {
EventEmitter.emit(NavigationTypes.BLUR_POST_DRAFT);
openMainSideMenu();
};
openSettingsSidebar = () => {
EventEmitter.emit(NavigationTypes.BLUR_POST_DRAFT);
openSettingsSideMenu();
};
render() {
const {theme} = this.props;
let component = this.renderLoadingOrFailedChannel();
if (!component) {
component = (
<KeyboardLayout>
<View style={style.flex}>
<ChannelPostList/>
</View>
<PostDraft
ref={this.postDraft}
screenId={this.props.componentId}
/>
</KeyboardLayout>
);
}
const drawerContent = (
<>
<ChannelNavBar
openMainSidebar={this.openMainSidebar}
openSettingsSidebar={this.openSettingsSidebar}
onPress={this.goToChannelInfo}
/>
{component}
<NetworkIndicator/>
{LocalConfig.EnableMobileClientUpgrade && <ClientUpgradeListener/>}
</>
);
return (
<>
<View style={style.flex}>
{drawerContent}
</View>
<InteractiveDialogController
theme={theme}
/>
</>
);
}
}
const style = StyleSheet.create({
flex: {
flex: 1,
},
});