mattermost-mobile/app/components/markdown/markdown_table_cell/index.tsx
Avinash Lingaloo e8ce78f39d
MM-36721 - [GEKIDOU] Porting Markdown components (#5586)
* Started with Channel Post List

* Added markdown hashtag

* Added TouchableWithFeedback component

* Added utils/bottom_sheet

* Removed BottomSheet in favor of future SlideUpPanel

* Added markdown_block_quote

* Added markdown_list_item

* Added markdown_list

* Added MarkDownTableCell component

* Markdown_table - in progress - need to verify TS

* Added markdown_table

* Update Podfile.lock

* Added deep_linking constant

* Added utils/draft

* Update config to include ExperimentalNormalizeMarkdownLinks

* Added markdown_link

* Added markdown_table_row

* Added ProgressiveImage and RetriableImage components and images utils

* Converted Retriable component to functional component

* Added type definition for commonmark

* Continuing with markdown TS

* Markdown - Typing props [ in progress ]

* Fix boolean flag with mardown block quote

* Adding observable config to markdown_link

* TS Fixes [ in progress ]

* TS fixes

* TS fixes - TextStyles

* Update markdown.tsx

* TS fixes on markdown

* TS Fixes - AtMention component

* AtMention [ IN PROGRESS ]

* Add markdown support

* Fix emoji and jumboEmoji on iOS

* Fix handleMyTeam operator

* Fix navigation style based on theme

* Fix iOS MattermostManaged deleteDatabse return error type

* wrap setNavigationStackStyles under a requestAnimationFrame

* Add preventDoubleTap to channel mention

* Increase double tap to 750ms

* Fix handleReceivedPostsInChannel chunk query

* Set initial navigation theme

* Swizzle FastImage on iOS

* fix preventDoubleTap test

Co-authored-by: Avinash Lingaloo <>
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
2021-08-02 20:30:17 +04:00

62 lines
1.5 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React, {ReactNode} from 'react';
import {View} from 'react-native';
import {useTheme} from '@context/theme';
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
export type MarkdownTableCellProps = {
align: 'left' | 'center' | 'right';
children: ReactNode;
isLastCell: boolean;
};
export const CELL_MIN_WIDTH = 96;
export const CELL_MAX_WIDTH = 192;
const getStyleSheet = makeStyleSheetFromTheme((theme) => {
return {
cell: {
flex: 1,
borderColor: changeOpacity(theme.centerChannelColor, 0.2),
justifyContent: 'flex-start',
padding: 8,
},
cellRightBorder: {
borderRightWidth: 1,
},
alignCenter: {
alignItems: 'center',
},
alignRight: {
alignItems: 'flex-end',
},
};
});
const MarkdownTableCell = ({isLastCell, align, children}: MarkdownTableCellProps) => {
const theme = useTheme();
const style = getStyleSheet(theme);
const cellStyle = [style.cell];
if (!isLastCell) {
cellStyle.push(style.cellRightBorder);
}
let textStyle = null;
if (align === 'center') {
textStyle = style.alignCenter;
} else if (align === 'right') {
textStyle = style.alignRight;
}
return (
<View style={[cellStyle, textStyle]}>
{children}
</View>
);
};
export default MarkdownTableCell;