2019-08-27 12:25:38 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { ScrollView } from 'react-native';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
import I18n from '../i18n';
|
|
|
|
import { isIOS } from '../utils/deviceInfo';
|
2019-12-04 16:39:53 +00:00
|
|
|
import { themes } from '../constants/colors';
|
|
|
|
import { withTheme } from '../theme';
|
|
|
|
import { themedHeader } from '../utils/navigation';
|
2019-08-27 12:25:38 +00:00
|
|
|
|
2019-12-04 16:39:53 +00:00
|
|
|
class MarkdownTableView extends React.Component {
|
|
|
|
static navigationOptions = ({ screenProps }) => ({
|
|
|
|
...themedHeader(screenProps.theme),
|
2019-08-27 12:25:38 +00:00
|
|
|
title: I18n.t('Table')
|
|
|
|
});
|
|
|
|
|
|
|
|
static propTypes = {
|
2019-12-04 16:39:53 +00:00
|
|
|
navigation: PropTypes.object,
|
|
|
|
theme: PropTypes.string
|
2019-08-27 12:25:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2019-12-04 16:39:53 +00:00
|
|
|
const { navigation, theme } = this.props;
|
2019-08-27 12:25:38 +00:00
|
|
|
const renderRows = navigation.getParam('renderRows');
|
|
|
|
const tableWidth = navigation.getParam('tableWidth');
|
|
|
|
|
|
|
|
if (isIOS) {
|
|
|
|
return (
|
2019-12-04 16:39:53 +00:00
|
|
|
<ScrollView style={{ backgroundColor: themes[theme].backgroundColor }} contentContainerStyle={{ width: tableWidth }}>
|
2019-08-27 12:25:38 +00:00
|
|
|
{renderRows()}
|
|
|
|
</ScrollView>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2019-12-04 16:39:53 +00:00
|
|
|
<ScrollView style={{ backgroundColor: themes[theme].backgroundColor }}>
|
2019-08-27 12:25:38 +00:00
|
|
|
<ScrollView horizontal>
|
|
|
|
{renderRows()}
|
|
|
|
</ScrollView>
|
|
|
|
</ScrollView>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2019-12-04 16:39:53 +00:00
|
|
|
|
|
|
|
export default withTheme(MarkdownTableView);
|