Chore: evaluate `MarkdownTableView` (#4104)
This commit is contained in:
parent
81c6ffce40
commit
4d4a5cffd9
|
@ -131,7 +131,7 @@ const ChatsStackNavigator = () => {
|
||||||
component={AddExistingChannelView}
|
component={AddExistingChannelView}
|
||||||
options={AddExistingChannelView.navigationOptions}
|
options={AddExistingChannelView.navigationOptions}
|
||||||
/>
|
/>
|
||||||
<ChatsStack.Screen name='MarkdownTableView' component={MarkdownTableView} options={MarkdownTableView.navigationOptions} />
|
<ChatsStack.Screen name='MarkdownTableView' component={MarkdownTableView} />
|
||||||
<ChatsStack.Screen name='ReadReceiptsView' component={ReadReceiptsView} options={ReadReceiptsView.navigationOptions} />
|
<ChatsStack.Screen name='ReadReceiptsView' component={ReadReceiptsView} options={ReadReceiptsView.navigationOptions} />
|
||||||
<ChatsStack.Screen name='QueueListView' component={QueueListView} options={QueueListView.navigationOptions} />
|
<ChatsStack.Screen name='QueueListView' component={QueueListView} options={QueueListView.navigationOptions} />
|
||||||
<ChatsStack.Screen name='CannedResponsesListView' component={CannedResponsesListView} />
|
<ChatsStack.Screen name='CannedResponsesListView' component={CannedResponsesListView} />
|
||||||
|
|
|
@ -166,7 +166,7 @@ const ModalStackNavigator = React.memo(({ navigation }: INavigation) => {
|
||||||
<ModalStack.Screen name='ThreadMessagesView' component={ThreadMessagesView} />
|
<ModalStack.Screen name='ThreadMessagesView' component={ThreadMessagesView} />
|
||||||
<ModalStack.Screen name='DiscussionsView' component={DiscussionsView} />
|
<ModalStack.Screen name='DiscussionsView' component={DiscussionsView} />
|
||||||
<ModalStack.Screen name='TeamChannelsView' component={TeamChannelsView} options={TeamChannelsView.navigationOptions} />
|
<ModalStack.Screen name='TeamChannelsView' component={TeamChannelsView} options={TeamChannelsView.navigationOptions} />
|
||||||
<ModalStack.Screen name='MarkdownTableView' component={MarkdownTableView} options={MarkdownTableView.navigationOptions} />
|
<ModalStack.Screen name='MarkdownTableView' component={MarkdownTableView} />
|
||||||
<ModalStack.Screen
|
<ModalStack.Screen
|
||||||
name='ReadReceiptsView'
|
name='ReadReceiptsView'
|
||||||
component={ReadReceiptsView}
|
component={ReadReceiptsView}
|
||||||
|
|
|
@ -1,43 +1,38 @@
|
||||||
import React from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { ScrollView } from 'react-native';
|
import { ScrollView } from 'react-native';
|
||||||
import { StackNavigationOptions } from '@react-navigation/stack';
|
|
||||||
import { RouteProp } from '@react-navigation/native';
|
|
||||||
|
|
||||||
import I18n from '../i18n';
|
import I18n from '../i18n';
|
||||||
import { isIOS } from '../utils/deviceInfo';
|
import { isIOS } from '../utils/deviceInfo';
|
||||||
import { themes } from '../lib/constants';
|
import { useTheme } from '../theme';
|
||||||
import { TSupportedThemes, withTheme } from '../theme';
|
|
||||||
import { ChatsStackParamList } from '../stacks/types';
|
import { ChatsStackParamList } from '../stacks/types';
|
||||||
|
import { IBaseScreen } from '../definitions';
|
||||||
|
|
||||||
interface IMarkdownTableViewProps {
|
type IMarkdownTableViewProps = IBaseScreen<ChatsStackParamList, 'MarkdownTableView'>;
|
||||||
route: RouteProp<ChatsStackParamList, 'MarkdownTableView'>;
|
|
||||||
theme: TSupportedThemes;
|
|
||||||
}
|
|
||||||
|
|
||||||
class MarkdownTableView extends React.Component<IMarkdownTableViewProps> {
|
const MarkdownTableView = ({ navigation, route }: IMarkdownTableViewProps): React.ReactElement => {
|
||||||
static navigationOptions = (): StackNavigationOptions => ({
|
|
||||||
title: I18n.t('Table')
|
|
||||||
});
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const { route, theme } = this.props;
|
|
||||||
const renderRows = route.params?.renderRows;
|
const renderRows = route.params?.renderRows;
|
||||||
const tableWidth = route.params?.tableWidth;
|
const tableWidth = route.params?.tableWidth;
|
||||||
|
const { colors } = useTheme();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
navigation.setOptions({
|
||||||
|
title: I18n.t('Table')
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
if (isIOS) {
|
if (isIOS) {
|
||||||
return (
|
return (
|
||||||
<ScrollView style={{ backgroundColor: themes[theme].backgroundColor }} contentContainerStyle={{ width: tableWidth }}>
|
<ScrollView style={{ backgroundColor: colors.backgroundColor }} contentContainerStyle={{ width: tableWidth }}>
|
||||||
{renderRows()}
|
{renderRows()}
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollView style={{ backgroundColor: themes[theme].backgroundColor }}>
|
<ScrollView style={{ backgroundColor: colors.backgroundColor }}>
|
||||||
<ScrollView horizontal>{renderRows()}</ScrollView>
|
<ScrollView horizontal>{renderRows()}</ScrollView>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
|
||||||
|
|
||||||
export default withTheme(MarkdownTableView);
|
export default MarkdownTableView;
|
||||||
|
|
Loading…
Reference in New Issue