2022-05-13 12:57:19 +00:00
|
|
|
import React, { useEffect } from 'react';
|
2019-08-27 12:25:38 +00:00
|
|
|
import { ScrollView } from 'react-native';
|
|
|
|
|
|
|
|
import I18n from '../i18n';
|
|
|
|
import { isIOS } from '../utils/deviceInfo';
|
2022-05-13 12:57:19 +00:00
|
|
|
import { useTheme } from '../theme';
|
2021-12-03 19:27:57 +00:00
|
|
|
import { ChatsStackParamList } from '../stacks/types';
|
2022-05-13 12:57:19 +00:00
|
|
|
import { IBaseScreen } from '../definitions';
|
2019-08-27 12:25:38 +00:00
|
|
|
|
2022-05-13 12:57:19 +00:00
|
|
|
type IMarkdownTableViewProps = IBaseScreen<ChatsStackParamList, 'MarkdownTableView'>;
|
2021-11-17 20:00:40 +00:00
|
|
|
|
2022-05-13 12:57:19 +00:00
|
|
|
const MarkdownTableView = ({ navigation, route }: IMarkdownTableViewProps): React.ReactElement => {
|
|
|
|
const renderRows = route.params?.renderRows;
|
|
|
|
const tableWidth = route.params?.tableWidth;
|
|
|
|
const { colors } = useTheme();
|
2019-08-27 12:25:38 +00:00
|
|
|
|
2022-05-13 12:57:19 +00:00
|
|
|
useEffect(() => {
|
|
|
|
navigation.setOptions({
|
|
|
|
title: I18n.t('Table')
|
|
|
|
});
|
|
|
|
}, []);
|
2019-08-27 12:25:38 +00:00
|
|
|
|
2022-05-13 12:57:19 +00:00
|
|
|
if (isIOS) {
|
2019-08-27 12:25:38 +00:00
|
|
|
return (
|
2022-05-13 12:57:19 +00:00
|
|
|
<ScrollView style={{ backgroundColor: colors.backgroundColor }} contentContainerStyle={{ width: tableWidth }}>
|
|
|
|
{renderRows()}
|
2019-08-27 12:25:38 +00:00
|
|
|
</ScrollView>
|
|
|
|
);
|
|
|
|
}
|
2019-12-04 16:39:53 +00:00
|
|
|
|
2022-05-13 12:57:19 +00:00
|
|
|
return (
|
|
|
|
<ScrollView style={{ backgroundColor: colors.backgroundColor }}>
|
|
|
|
<ScrollView horizontal>{renderRows()}</ScrollView>
|
|
|
|
</ScrollView>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default MarkdownTableView;
|