added isLandscape (#4210)

Co-authored-by: rahimrahman <rahim@r2integration.com>
This commit is contained in:
Mattermost Build 2020-04-23 03:54:07 +02:00 committed by GitHub
parent ecee2074a1
commit 7f3ff62609
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -20,11 +20,13 @@ import {
getKeyboardAppearanceFromTheme,
} from 'app/utils/theme';
import {popTopScreen} from 'app/actions/navigation';
import {marginHorizontal as margin} from 'app/components/safe_area_view/iphone_x_spacing';
export default class Code extends React.PureComponent {
static propTypes = {
theme: PropTypes.object.isRequired,
content: PropTypes.string.isRequired,
isLandscape: PropTypes.bool.isRequired,
};
componentDidMount() {
@ -45,6 +47,7 @@ export default class Code extends React.PureComponent {
};
render() {
const {isLandscape} = this.props;
const style = getStyleSheet(this.props.theme);
const numberOfLines = this.countLines(this.props.content);
@ -86,7 +89,7 @@ export default class Code extends React.PureComponent {
return (
<ScrollView
style={style.scrollContainer}
style={[style.scrollContainer, margin(isLandscape)]}
contentContainerStyle={style.container}
>
<View style={lineNumbersStyle}>

View file

@ -5,12 +5,14 @@ import {connect} from 'react-redux';
import {getTheme} from '@mm-redux/selectors/entities/preferences';
import {isLandscape} from 'app/selectors/device';
import Code from './code';
function mapStateToProps(state) {
return {
theme: getTheme(state),
isLandscape: isLandscape(state),
};
}
export default connect(mapStateToProps)(Code);
export default connect(mapStateToProps)(Code);