added isLandscape (#4188)

This commit is contained in:
Rahim Rahman 2020-04-22 19:48:51 -06:00 committed by GitHub
parent 6705c59f73
commit b5ef54527f
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);