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 => ({
|
const renderRows = route.params?.renderRows;
|
||||||
title: I18n.t('Table')
|
const tableWidth = route.params?.tableWidth;
|
||||||
});
|
const { colors } = useTheme();
|
||||||
|
|
||||||
render() {
|
useEffect(() => {
|
||||||
const { route, theme } = this.props;
|
navigation.setOptions({
|
||||||
const renderRows = route.params?.renderRows;
|
title: I18n.t('Table')
|
||||||
const tableWidth = route.params?.tableWidth;
|
});
|
||||||
|
}, []);
|
||||||
if (isIOS) {
|
|
||||||
return (
|
|
||||||
<ScrollView style={{ backgroundColor: themes[theme].backgroundColor }} contentContainerStyle={{ width: tableWidth }}>
|
|
||||||
{renderRows()}
|
|
||||||
</ScrollView>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (isIOS) {
|
||||||
return (
|
return (
|
||||||
<ScrollView style={{ backgroundColor: themes[theme].backgroundColor }}>
|
<ScrollView style={{ backgroundColor: colors.backgroundColor }} contentContainerStyle={{ width: tableWidth }}>
|
||||||
<ScrollView horizontal>{renderRows()}</ScrollView>
|
{renderRows()}
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
export default withTheme(MarkdownTableView);
|
return (
|
||||||
|
<ScrollView style={{ backgroundColor: colors.backgroundColor }}>
|
||||||
|
<ScrollView horizontal>{renderRows()}</ScrollView>
|
||||||
|
</ScrollView>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default MarkdownTableView;
|
||||||
|
|
Loading…
Reference in New Issue