* WIP: slash suggestion autocomplete * WIP: patched styles a bit * WIP: Adding styles * Adding active state to autocomplete items * Fixing style for channel mention item * Fixing bugs + styling issues for Android * Updating snapshot * Fixing autocomplete to render on top of post draft - Misc style fixes * Renaming props, patching slash suggestion icon * Fixing tests and lint errors * Resolving post-merge issue with slash commands * Fixing android positioning for autocomplete * Fixing autocomplete not scrolling in edit_channel_info * WIP: Fixing things according to UX Review * UX Fixes to autocomplete * Updating snapshots * Updating snapshots, replacing slash-command icons * Fixing android scrolling and positioning issues * Fixing issues with date_suggestion not rendering * Making use of the "ShowFullName" config in at_mention_item * Removing top border on first autocomplete section * Allowing autocomplete to be smaller than its maxWidth * Fixing slash_suggestion padding * removing "componentWillReceiveProps" from date_suggestion * Changing edit_channel_info autocomplete offset * Replacing toUpperCase() with textTransform: uppercase * Fixing odd border issues + prop validation warning * Restore section header background & add paddingBottom * Patching up padding on channel mentions - Reverting previous incorrect padding adjustments * Removing inline 'completeSuggestion' function * Removing brackets from style prop
131 lines
No EOL
4.5 KiB
JavaScript
131 lines
No EOL
4.5 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 LocalConfig from '@assets/config';
|
|
import Autocomplete, {AUTOCOMPLETE_MAX_HEIGHT} from '@components/autocomplete';
|
|
import InteractiveDialogController from '@components/interactive_dialog_controller';
|
|
import NetworkIndicator from '@components/network_indicator';
|
|
import PostDraft from '@components/post_draft';
|
|
import SafeAreaView from '@components/safe_area_view';
|
|
import MainSidebar from '@components/sidebars/main';
|
|
import SettingsSidebar from '@components/sidebars/settings';
|
|
import StatusBar from '@components/status_bar';
|
|
import {ACCESSORIES_CONTAINER_NATIVE_ID, CHANNEL_POST_TEXTBOX_CURSOR_CHANGE, CHANNEL_POST_TEXTBOX_VALUE_CHANGE} from '@constants/post_draft';
|
|
import {makeStyleSheetFromTheme} from '@utils/theme';
|
|
|
|
import ChannelBase, {ClientUpgradeListener} from './channel_base';
|
|
import ChannelNavBar from './channel_nav_bar';
|
|
import ChannelPostList from './channel_post_list';
|
|
|
|
export default class ChannelIOS extends ChannelBase {
|
|
handleAutoComplete = (value) => {
|
|
if (this.postDraft?.current) {
|
|
this.postDraft.current.handleInputQuickAction(value);
|
|
}
|
|
};
|
|
|
|
mainSidebarRef = (ref) => {
|
|
if (ref) {
|
|
this.mainSidebar = ref;
|
|
}
|
|
};
|
|
|
|
settingsSidebarRef = (ref) => {
|
|
if (ref) {
|
|
this.settingsSidebar = ref;
|
|
}
|
|
};
|
|
|
|
openMainSidebar = () => {
|
|
if (this.mainSidebar) {
|
|
this.mainSidebar.open();
|
|
}
|
|
};
|
|
|
|
openSettingsSidebar = () => {
|
|
if (this.settingsSidebar) {
|
|
this.settingsSidebar.open();
|
|
}
|
|
};
|
|
|
|
render() {
|
|
const {currentChannelId, theme} = this.props;
|
|
let component = this.renderLoadingOrFailedChannel();
|
|
let renderDraftArea = false;
|
|
|
|
if (!component) {
|
|
renderDraftArea = true;
|
|
component = (
|
|
<>
|
|
<ChannelPostList
|
|
updateNativeScrollView={this.updateNativeScrollView}
|
|
registerTypingAnimation={this.registerTypingAnimation}
|
|
/>
|
|
{LocalConfig.EnableMobileClientUpgrade && <ClientUpgradeListener/>}
|
|
</>
|
|
);
|
|
}
|
|
|
|
const style = getStyle(theme);
|
|
const drawerContent = (
|
|
<>
|
|
<SafeAreaView>
|
|
<StatusBar/>
|
|
<NetworkIndicator/>
|
|
<ChannelNavBar
|
|
openMainSidebar={this.openMainSidebar}
|
|
openSettingsSidebar={this.openSettingsSidebar}
|
|
onPress={this.goToChannelInfo}
|
|
/>
|
|
{component}
|
|
</SafeAreaView>
|
|
{renderDraftArea &&
|
|
<PostDraft
|
|
accessoriesContainerID={ACCESSORIES_CONTAINER_NATIVE_ID}
|
|
cursorPositionEvent={CHANNEL_POST_TEXTBOX_CURSOR_CHANGE}
|
|
ref={this.postDraft}
|
|
registerTypingAnimation={this.registerTypingAnimation}
|
|
screenId={this.props.componentId}
|
|
scrollViewNativeID={currentChannelId}
|
|
valueEvent={CHANNEL_POST_TEXTBOX_VALUE_CHANGE}
|
|
/>
|
|
}
|
|
<View nativeID={ACCESSORIES_CONTAINER_NATIVE_ID}>
|
|
<Autocomplete
|
|
maxHeight={AUTOCOMPLETE_MAX_HEIGHT}
|
|
onChangeText={this.handleAutoComplete}
|
|
cursorPositionEvent={CHANNEL_POST_TEXTBOX_CURSOR_CHANGE}
|
|
valueEvent={CHANNEL_POST_TEXTBOX_VALUE_CHANGE}
|
|
channelId={currentChannelId}
|
|
/>
|
|
</View>
|
|
</>
|
|
);
|
|
|
|
return (
|
|
<MainSidebar
|
|
testID='channel_screen'
|
|
ref={this.mainSidebarRef}
|
|
>
|
|
<SettingsSidebar ref={this.settingsSidebarRef}>
|
|
<View style={style.backdrop}>
|
|
{drawerContent}
|
|
</View>
|
|
</SettingsSidebar>
|
|
<InteractiveDialogController
|
|
theme={theme}
|
|
/>
|
|
</MainSidebar>
|
|
);
|
|
}
|
|
}
|
|
|
|
const getStyle = makeStyleSheetFromTheme((theme) => ({
|
|
backdrop: {
|
|
flex: 1,
|
|
backgroundColor: theme.centerChannelBg,
|
|
},
|
|
})); |