Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/share.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const OutsideStack = () => {

return (
<Outside.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme) }}>
<Outside.Screen name='WithoutServersView' component={WithoutServersView} options={WithoutServersView.navigationOptions} />
<Outside.Screen name='WithoutServersView' component={WithoutServersView} />
</Outside.Navigator>
);
};
Expand Down
48 changes: 23 additions & 25 deletions app/views/WithoutServersView.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import React, { useLayoutEffect } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import ShareExtension from 'rn-extensions-share';
import { useNavigation } from '@react-navigation/native';

import * as HeaderButton from '../containers/HeaderButton';
import sharedStyles from './Styles';
import I18n from '../i18n';
import { themes } from '../lib/constants';
import { TSupportedThemes, withTheme } from '../theme';
import { useTheme } from '../theme';
import sharedStyles from './Styles';

const styles = StyleSheet.create({
container: {
Expand All @@ -26,27 +26,25 @@ const styles = StyleSheet.create({
}
});

interface IWithoutServerViewProps {
theme: TSupportedThemes;
}
const WithoutServerView = (): React.ReactElement => {
const navigation = useNavigation();
const { colors } = useTheme();

class WithoutServerView extends React.Component<IWithoutServerViewProps> {
static navigationOptions = () => ({
title: 'Rocket.Chat',
headerLeft: () => <HeaderButton.CancelModal onPress={ShareExtension.close} testID='share-extension-close' />
});
useLayoutEffect(() => {
navigation.setOptions({
title: 'Rocket.Chat',
headerLeft: () => <HeaderButton.CancelModal onPress={ShareExtension.close} testID='share-extension-close' />
});
}, [navigation]);

render() {
const { theme } = this.props;
return (
<View style={[styles.container, { backgroundColor: themes[theme].backgroundColor }]}>
<Text style={[styles.title, { color: themes[theme].titleText }]}>{I18n.t('Without_Servers')}</Text>
<Text style={[styles.content, { color: themes[theme].titleText }]}>
{I18n.t('You_need_to_access_at_least_one_RocketChat_server_to_share_something')}
</Text>
</View>
);
}
}
return (
<View style={[styles.container, { backgroundColor: colors.backgroundColor }]}>
<Text style={[styles.title, { color: colors.titleText }]}>{I18n.t('Without_Servers')}</Text>
<Text style={[styles.content, { color: colors.titleText }]}>
{I18n.t('You_need_to_access_at_least_one_RocketChat_server_to_share_something')}
</Text>
</View>
);
};

export default withTheme(WithoutServerView);
export default WithoutServerView;