mattermost-mobile/app/components/markdown/markdown_table_cell/markdown_table_cell.js
Elias Nahum dbd7bc8a51
Gallery Improvements (#4837)
* Open/Close Gallery transitions

* Include postId in file info & disable opening the gallery in some cases

* Add progress bar component

* Transition to gallery based on platform

* Improve getting the filename for non attachments

* Patch RNFetchBlob TS definition

* Add gallery types

* fix unit tests for message and post attachment

* add getLocalPath method

* Add react-native-share dependency

* Re-style gallery footer

* Refactor Gallery screen

* Double tap zoom in/out and translate

* Make android activity "transparent"

* Do not animate to height on dismissing gallery

* Open gallery for file uploads

* Fix borderRadius for gallery action button

* Use progress bar for file uploads

* Replace progress bar for file attachment document

* Upgrade RNN to 7.1.0 to fix share elements transitions

* Fix Gallery unit tests

* translate down when popping screen on iOS

* Swipe, Pan & Tap fixes

* fix gallery footer avatar eslint

* Fix gallery snapshot tests

* Use CompassIcon in Gallery

* Feedback from UX review

* Fix gallery UI for other file types

* Set other file type gallery button to 48pt
2020-11-06 21:17:27 -03:00

62 lines
1.7 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import PropTypes from 'prop-types';
import React from 'react';
import {View} from 'react-native';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
export const CELL_MIN_WIDTH = 96;
export const CELL_MAX_WIDTH = 192;
export default class MarkdownTableCell extends React.PureComponent {
static propTypes = {
align: PropTypes.oneOf(['', 'left', 'center', 'right']),
children: PropTypes.node,
isLastCell: PropTypes.bool,
theme: PropTypes.object.isRequired,
};
render() {
const style = getStyleSheet(this.props.theme);
const cellStyle = [style.cell];
if (!this.props.isLastCell) {
cellStyle.push(style.cellRightBorder);
}
let textStyle = null;
if (this.props.align === 'center') {
textStyle = style.alignCenter;
} else if (this.props.align === 'right') {
textStyle = style.alignRight;
}
return (
<View style={[cellStyle, textStyle]}>
{this.props.children}
</View>
);
}
}
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',
},
};
});