mattermost-mobile/app/screens/thread/thread.android.js
Elias Nahum 1a605891fe
MM-22401 Refactor Post Draft (#4122)
* Babel TS and Eslint config

* Channel is archived component

* Move Typing component

* Move Uploads component

* Add PostInput component

* QuickActions components

* Add PostDraft component

* Remove old PostTextbox component

* Rename post_textbox constant

* Fix Autocomplete

* Rename blur post draft event

* Fix references

* Feedback review

* Fix autocomplete for iOS
2020-05-06 06:30:51 -04:00

76 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 {View} from 'react-native';
import KeyboardLayout from '@components/layout/keyboard_layout';
import Loading from '@components/loading';
import PostList from '@components/post_list';
import PostDraft from '@components/post_draft';
import SafeAreaView from '@components/safe_area_view';
import StatusBar from '@components/status_bar';
import {THREAD} from '@constants/screen';
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
import ThreadBase from './thread_base';
export default class ThreadAndroid extends ThreadBase {
render() {
const {
channelId,
myMember,
postIds,
rootId,
channelIsArchived,
theme,
} = this.props;
let content;
if (this.hasRootPost()) {
content = (
<>
<PostList
renderFooter={this.renderFooter()}
indicateNewMessages={false}
postIds={postIds}
currentUserId={myMember && myMember.user_id}
lastViewedAt={this.state.lastViewedAt}
lastPostIndex={-1}
onPostPress={this.hideKeyboard}
location={THREAD}
/>
<PostDraft
ref={this.postDraft}
channelId={channelId}
channelIsArchived={channelIsArchived}
rootId={rootId}
screenId={this.props.componentId}
/>
</>
);
} else {
content = (
<Loading color={theme.centerChannelColor}/>
);
}
const style = getStyleSheet(theme);
return (
<SafeAreaView>
<StatusBar/>
<KeyboardLayout>
<View style={style.separator}/>
{content}
</KeyboardLayout>
</SafeAreaView>
);
}
}
const getStyleSheet = makeStyleSheetFromTheme((theme) => ({
separator: {
backgroundColor: changeOpacity(theme.centerChannelColor, 0.2),
height: 1,
},
}));