Chore: Migrate WithoutServerView to hooks (#4415)
* migrate WithoutServerView to hooks * remove navigation options * minor tweak Co-authored-by: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Co-authored-by: Reinaldo Neto <reinaldonetof@hotmail.com>
This commit is contained in:
parent
6b8086aa55
commit
a101d319e5
|
@ -72,7 +72,7 @@ const OutsideStack = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Outside.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme) }}>
|
<Outside.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme) }}>
|
||||||
<Outside.Screen name='WithoutServersView' component={WithoutServersView} options={WithoutServersView.navigationOptions} />
|
<Outside.Screen name='WithoutServersView' component={WithoutServersView} />
|
||||||
</Outside.Navigator>
|
</Outside.Navigator>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import React from 'react';
|
import React, { useLayoutEffect } from 'react';
|
||||||
import { StyleSheet, Text, View } from 'react-native';
|
import { StyleSheet, Text, View } from 'react-native';
|
||||||
import ShareExtension from 'rn-extensions-share';
|
import ShareExtension from 'rn-extensions-share';
|
||||||
|
import { useNavigation } from '@react-navigation/native';
|
||||||
|
|
||||||
import * as HeaderButton from '../containers/HeaderButton';
|
import * as HeaderButton from '../containers/HeaderButton';
|
||||||
import sharedStyles from './Styles';
|
|
||||||
import I18n from '../i18n';
|
import I18n from '../i18n';
|
||||||
import { themes } from '../lib/constants';
|
import { useTheme } from '../theme';
|
||||||
import { TSupportedThemes, withTheme } from '../theme';
|
import sharedStyles from './Styles';
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
|
@ -26,27 +26,25 @@ const styles = StyleSheet.create({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
interface IWithoutServerViewProps {
|
const WithoutServerView = (): React.ReactElement => {
|
||||||
theme: TSupportedThemes;
|
const navigation = useNavigation();
|
||||||
}
|
const { colors } = useTheme();
|
||||||
|
|
||||||
class WithoutServerView extends React.Component<IWithoutServerViewProps> {
|
useLayoutEffect(() => {
|
||||||
static navigationOptions = () => ({
|
navigation.setOptions({
|
||||||
title: 'Rocket.Chat',
|
title: 'Rocket.Chat',
|
||||||
headerLeft: () => <HeaderButton.CancelModal onPress={ShareExtension.close} testID='share-extension-close' />
|
headerLeft: () => <HeaderButton.CancelModal onPress={ShareExtension.close} testID='share-extension-close' />
|
||||||
});
|
});
|
||||||
|
}, [navigation]);
|
||||||
|
|
||||||
render() {
|
return (
|
||||||
const { theme } = this.props;
|
<View style={[styles.container, { backgroundColor: colors.backgroundColor }]}>
|
||||||
return (
|
<Text style={[styles.title, { color: colors.titleText }]}>{I18n.t('Without_Servers')}</Text>
|
||||||
<View style={[styles.container, { backgroundColor: themes[theme].backgroundColor }]}>
|
<Text style={[styles.content, { color: colors.titleText }]}>
|
||||||
<Text style={[styles.title, { color: themes[theme].titleText }]}>{I18n.t('Without_Servers')}</Text>
|
{I18n.t('You_need_to_access_at_least_one_RocketChat_server_to_share_something')}
|
||||||
<Text style={[styles.content, { color: themes[theme].titleText }]}>
|
</Text>
|
||||||
{I18n.t('You_need_to_access_at_least_one_RocketChat_server_to_share_something')}
|
</View>
|
||||||
</Text>
|
);
|
||||||
</View>
|
};
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default withTheme(WithoutServerView);
|
export default WithoutServerView;
|
||||||
|
|
Loading…
Reference in New Issue