This commit is contained in:
Diego Mello 2020-05-21 18:34:01 -03:00
parent e03d423e99
commit f59d8e0d3c
33 changed files with 273 additions and 308 deletions

View File

@ -6,17 +6,19 @@ import { themes } from '../constants/colors';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
view: { view: {
flex: 1, flex: 1
},
vertical: {
paddingTop: 0, paddingTop: 0,
paddingBottom: 0 paddingBottom: 0
} }
}); });
const SafeAreaView = React.memo(({ const SafeAreaView = React.memo(({
style, children, testID, theme, ...props style, children, testID, theme, vertical = true, ...props
}) => ( }) => (
<SafeAreaContext <SafeAreaContext
style={[styles.view, { backgroundColor: themes[theme].auxiliaryBackground }, style]} style={[styles.view, vertical && styles.vertical, { backgroundColor: themes[theme].auxiliaryBackground }, style]}
testID={testID} testID={testID}
{...props} {...props}
> >
@ -27,6 +29,7 @@ const SafeAreaView = React.memo(({
SafeAreaView.propTypes = { SafeAreaView.propTypes = {
testID: PropTypes.string, testID: PropTypes.string,
theme: PropTypes.string, theme: PropTypes.string,
vertical: PropTypes.bool,
style: PropTypes.object, style: PropTypes.object,
children: PropTypes.element children: PropTypes.element
}; };

View File

@ -68,7 +68,7 @@ const ChatsStack = () => {
component={RoomView} component={RoomView}
options={RoomView.navigationOptions} options={RoomView.navigationOptions}
/> />
{/* <Chats.Screen <Chats.Screen
name='RoomActionsView' name='RoomActionsView'
component={RoomActionsView} component={RoomActionsView}
options={RoomActionsView.navigationOptions} options={RoomActionsView.navigationOptions}
@ -142,7 +142,7 @@ const ChatsStack = () => {
name='ReadReceiptsView' name='ReadReceiptsView'
component={ReadReceiptsView} component={ReadReceiptsView}
options={ReadReceiptsView.navigationOptions} options={ReadReceiptsView.navigationOptions}
/> */} />
</Chats.Navigator> </Chats.Navigator>
); );
}; };

View File

@ -24,8 +24,8 @@ const styles = StyleSheet.create({
} }
}); });
export default React.memo(withTheme(({ theme, navigation }) => { export default React.memo(withTheme(({ theme, route }) => {
const text = navigation.getParam('text'); const text = route.params?.text;
return ( return (
<View style={[styles.container, { backgroundColor: themes[theme].backgroundColor }]}> <View style={[styles.container, { backgroundColor: themes[theme].backgroundColor }]}>
<StatusBar theme={theme} /> <StatusBar theme={theme} />

View File

@ -14,7 +14,6 @@ import Separator from '../../containers/Separator';
import { SWITCH_TRACK_COLOR, themes } from '../../constants/colors'; import { SWITCH_TRACK_COLOR, themes } from '../../constants/colors';
import scrollPersistTaps from '../../utils/scrollPersistTaps'; import scrollPersistTaps from '../../utils/scrollPersistTaps';
import { withTheme } from '../../theme'; import { withTheme } from '../../theme';
import { themedHeader } from '../../utils/navigation';
import SafeAreaView from '../../containers/SafeAreaView'; import SafeAreaView from '../../containers/SafeAreaView';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
@ -49,20 +48,19 @@ SectionSeparator.propTypes = {
}; };
class AutoTranslateView extends React.Component { class AutoTranslateView extends React.Component {
static navigationOptions = ({ screenProps }) => ({ static navigationOptions = {
title: I18n.t('Auto_Translate'), title: I18n.t('Auto_Translate')
...themedHeader(screenProps.theme) }
})
static propTypes = { static propTypes = {
navigation: PropTypes.object, route: PropTypes.object,
theme: PropTypes.string theme: PropTypes.string
} }
constructor(props) { constructor(props) {
super(props); super(props);
this.rid = props.navigation.getParam('rid'); this.rid = props.route.params?.rid;
const room = props.navigation.getParam('room'); const room = props.route.params?.room;
if (room && room.observe) { if (room && room.observe) {
this.roomObservable = room.observe(); this.roomObservable = room.observe();

View File

@ -60,10 +60,9 @@ const styles = StyleSheet.create({
}); });
class DefaultBrowserView extends React.Component { class DefaultBrowserView extends React.Component {
static navigationOptions = ({ screenProps }) => ({ static navigationOptions = {
title: I18n.t('Default_browser'), title: I18n.t('Default_browser')
...themedHeader(screenProps.theme) }
})
static propTypes = { static propTypes = {
theme: PropTypes.string theme: PropTypes.string

View File

@ -14,26 +14,25 @@ import SearchBox from '../../containers/SearchBox';
import { CustomIcon } from '../../lib/Icons'; import { CustomIcon } from '../../lib/Icons';
import StatusBar from '../../containers/StatusBar'; import StatusBar from '../../containers/StatusBar';
import ActivityIndicator from '../../containers/ActivityIndicator'; import ActivityIndicator from '../../containers/ActivityIndicator';
import { CloseModalButton } from '../../containers/HeaderButton'; // import { CloseModalButton } from '../../containers/HeaderButton';
import debounce from '../../utils/debounce'; import debounce from '../../utils/debounce';
import log from '../../utils/log'; import log from '../../utils/log';
import Options from './Options'; import Options from './Options';
import { withTheme } from '../../theme'; import { withTheme } from '../../theme';
import { themes } from '../../constants/colors'; import { themes } from '../../constants/colors';
import styles from './styles'; import styles from './styles';
import { themedHeader } from '../../utils/navigation';
import { getUserSelector } from '../../selectors/login'; import { getUserSelector } from '../../selectors/login';
import SafeAreaView from '../../containers/SafeAreaView'; import SafeAreaView from '../../containers/SafeAreaView';
class DirectoryView extends React.Component { class DirectoryView extends React.Component {
static navigationOptions = ({ navigation, screenProps }) => { static navigationOptions = () => {
const options = { const options = {
...themedHeader(screenProps.theme),
title: I18n.t('Directory') title: I18n.t('Directory')
}; };
if (screenProps.split) { // TODO: ?
options.headerLeft = <CloseModalButton navigation={navigation} testID='directory-view-close' />; // if (screenProps.split) {
} // options.headerLeft = <CloseModalButton navigation={navigation} testID='directory-view-close' />;
// }
return options; return options;
} }

View File

@ -11,11 +11,13 @@ import I18n from '../i18n';
import RocketChat from '../lib/rocketchat'; import RocketChat from '../lib/rocketchat';
import { withTheme } from '../theme'; import { withTheme } from '../theme';
import { themes } from '../constants/colors'; import { themes } from '../constants/colors';
import { themedHeader } from '../utils/navigation';
import FormContainer, { FormContainerInner } from '../containers/FormContainer'; import FormContainer, { FormContainerInner } from '../containers/FormContainer';
import { LegalButton } from '../containers/HeaderButton';
class ForgotPasswordView extends React.Component { class ForgotPasswordView extends React.Component {
static navigatonOptions = ({ route }) => ({
title: route.params.title
})
static propTypes = { static propTypes = {
navigation: PropTypes.object, navigation: PropTypes.object,
theme: PropTypes.string theme: PropTypes.string
@ -107,8 +109,4 @@ class ForgotPasswordView extends React.Component {
} }
} }
ForgotPasswordView.navigatonOptions = ({ route }) => ({
title: route.params.title
});
export default withTheme(ForgotPasswordView); export default withTheme(ForgotPasswordView);

View File

@ -16,7 +16,6 @@ import I18n from '../../i18n';
import StatusBar from '../../containers/StatusBar'; import StatusBar from '../../containers/StatusBar';
import { themes } from '../../constants/colors'; import { themes } from '../../constants/colors';
import { withTheme } from '../../theme'; import { withTheme } from '../../theme';
import { themedHeader } from '../../utils/navigation';
import Separator from '../../containers/Separator'; import Separator from '../../containers/Separator';
import SafeAreaView from '../../containers/SafeAreaView'; import SafeAreaView from '../../containers/SafeAreaView';
@ -60,13 +59,13 @@ const OPTIONS = {
}; };
class InviteUsersView extends React.Component { class InviteUsersView extends React.Component {
static navigationOptions = ({ screenProps }) => ({ static navigationOptions = {
title: I18n.t('Invite_users'), title: I18n.t('Invite_users')
...themedHeader(screenProps.theme) }
})
static propTypes = { static propTypes = {
navigation: PropTypes.object, navigation: PropTypes.object,
route: PropTypes.object,
theme: PropTypes.string, theme: PropTypes.string,
timeDateFormat: PropTypes.string, timeDateFormat: PropTypes.string,
createInviteLink: PropTypes.func, createInviteLink: PropTypes.func,
@ -75,7 +74,7 @@ class InviteUsersView extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.rid = props.navigation.getParam('rid'); this.rid = props.route.params?.rid;
} }
onValueChangePicker = (key, value) => { onValueChangePicker = (key, value) => {

View File

@ -1,7 +1,6 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { View, Share, ScrollView, SafeAreaView } from 'react-native'; import { View, Share, ScrollView } from 'react-native';
// import { SafeAreaView } from 'react-navigation';
import moment from 'moment'; import moment from 'moment';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
@ -18,16 +17,16 @@ import I18n from '../../i18n';
import StatusBar from '../../containers/StatusBar'; import StatusBar from '../../containers/StatusBar';
import { themes } from '../../constants/colors'; import { themes } from '../../constants/colors';
import { withTheme } from '../../theme'; import { withTheme } from '../../theme';
import { themedHeader } from '../../utils/navigation'; import SafeAreaView from '../../containers/SafeAreaView';
class InviteUsersView extends React.Component { class InviteUsersView extends React.Component {
static navigationOptions = ({ screenProps }) => ({ static navigationOptions = {
title: I18n.t('Invite_users'), title: I18n.t('Invite_users')
...themedHeader(screenProps.theme) }
})
static propTypes = { static propTypes = {
navigation: PropTypes.object, navigation: PropTypes.object,
route: PropTypes.object,
theme: PropTypes.string, theme: PropTypes.string,
timeDateFormat: PropTypes.string, timeDateFormat: PropTypes.string,
invite: PropTypes.object, invite: PropTypes.object,
@ -37,7 +36,7 @@ class InviteUsersView extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.rid = props.navigation.getParam('rid'); this.rid = props.route.params?.rid;
} }
componentDidMount() { componentDidMount() {
@ -100,7 +99,7 @@ class InviteUsersView extends React.Component {
theme, invite theme, invite
} = this.props; } = this.props;
return ( return (
<SafeAreaView style={[styles.container, { backgroundColor: themes[theme].backgroundColor }]} forceInset={{ vertical: 'never' }}> <SafeAreaView style={{ backgroundColor: themes[theme].backgroundColor }} theme={theme}>
<ScrollView <ScrollView
{...scrollPersistTaps} {...scrollPersistTaps}
style={{ backgroundColor: themes[theme].auxiliaryBackground }} style={{ backgroundColor: themes[theme].auxiliaryBackground }}

View File

@ -1,9 +1,6 @@
import { StyleSheet } from 'react-native'; import { StyleSheet } from 'react-native';
export default StyleSheet.create({ export default StyleSheet.create({
container: {
flex: 1
},
innerContainer: { innerContainer: {
padding: 20, padding: 20,
paddingBottom: 0 paddingBottom: 0

View File

@ -15,7 +15,6 @@ import ListItem from '../../containers/ListItem';
import Separator from '../../containers/Separator'; import Separator from '../../containers/Separator';
import { themes } from '../../constants/colors'; import { themes } from '../../constants/colors';
import { withTheme } from '../../theme'; import { withTheme } from '../../theme';
import { themedHeader } from '../../utils/navigation';
import { appStart as appStartAction } from '../../actions'; import { appStart as appStartAction } from '../../actions';
import { getUserSelector } from '../../selectors/login'; import { getUserSelector } from '../../selectors/login';
import database from '../../lib/database'; import database from '../../lib/database';
@ -59,10 +58,9 @@ const LANGUAGES = [
]; ];
class LanguageView extends React.Component { class LanguageView extends React.Component {
static navigationOptions = ({ screenProps }) => ({ static navigationOptions = {
title: I18n.t('Change_Language'), title: I18n.t('Change_Language')
...themedHeader(screenProps.theme) }
})
static propTypes = { static propTypes = {
user: PropTypes.object, user: PropTypes.object,

View File

@ -51,6 +51,11 @@ const styles = StyleSheet.create({
}); });
class LoginView extends React.Component { class LoginView extends React.Component {
static navigatonOptions = ({ route, navigation }) => ({
title: route.params.title,
headerRight: () => <LegalButton testID='login-view-more' navigation={navigation} />
})
static propTypes = { static propTypes = {
navigation: PropTypes.object, navigation: PropTypes.object,
Site_Name: PropTypes.string, Site_Name: PropTypes.string,
@ -220,9 +225,4 @@ const mapDispatchToProps = dispatch => ({
loginRequest: params => dispatch(loginRequestAction(params)) loginRequest: params => dispatch(loginRequestAction(params))
}); });
LoginView.navigatonOptions = ({ route, navigation }) => ({
title: route.params.title,
headerRight: () => <LegalButton testID='login-view-more' navigation={navigation} />
});
export default connect(mapStateToProps, mapDispatchToProps)(withTheme(LoginView)); export default connect(mapStateToProps, mapDispatchToProps)(withTheme(LoginView));

View File

@ -6,23 +6,21 @@ import I18n from '../i18n';
import { isIOS } from '../utils/deviceInfo'; import { isIOS } from '../utils/deviceInfo';
import { themes } from '../constants/colors'; import { themes } from '../constants/colors';
import { withTheme } from '../theme'; import { withTheme } from '../theme';
import { themedHeader } from '../utils/navigation';
class MarkdownTableView extends React.Component { class MarkdownTableView extends React.Component {
static navigationOptions = ({ screenProps }) => ({ static navigationOptions = {
...themedHeader(screenProps.theme),
title: I18n.t('Table') title: I18n.t('Table')
}); }
static propTypes = { static propTypes = {
navigation: PropTypes.object, route: PropTypes.object,
theme: PropTypes.string theme: PropTypes.string
} }
render() { render() {
const { navigation, theme } = this.props; const { route, theme } = this.props;
const renderRows = navigation.getParam('renderRows'); const renderRows = route.params?.renderRows;
const tableWidth = navigation.getParam('tableWidth'); const tableWidth = route.params?.tableWidth;
if (isIOS) { if (isIOS) {
return ( return (

View File

@ -15,7 +15,6 @@ import getFileUrlFromMessage from '../../lib/methods/helpers/getFileUrlFromMessa
import { themes } from '../../constants/colors'; import { themes } from '../../constants/colors';
import { withTheme } from '../../theme'; import { withTheme } from '../../theme';
import { withSplit } from '../../split'; import { withSplit } from '../../split';
import { themedHeader } from '../../utils/navigation';
import { getUserSelector } from '../../selectors/login'; import { getUserSelector } from '../../selectors/login';
import SafeAreaView from '../../containers/SafeAreaView'; import SafeAreaView from '../../containers/SafeAreaView';
@ -23,15 +22,15 @@ const ACTION_INDEX = 0;
const CANCEL_INDEX = 1; const CANCEL_INDEX = 1;
class MessagesView extends React.Component { class MessagesView extends React.Component {
static navigationOptions = ({ navigation, screenProps }) => ({ static navigationOptions = ({ route }) => ({
title: I18n.t(navigation.state.params.name), title: I18n.t(route.params?.name)
...themedHeader(screenProps.theme)
}); });
static propTypes = { static propTypes = {
user: PropTypes.object, user: PropTypes.object,
baseUrl: PropTypes.string, baseUrl: PropTypes.string,
navigation: PropTypes.object, navigation: PropTypes.object,
route: PropTypes.object,
customEmojis: PropTypes.object, customEmojis: PropTypes.object,
theme: PropTypes.string, theme: PropTypes.string,
split: PropTypes.bool split: PropTypes.bool
@ -44,9 +43,9 @@ class MessagesView extends React.Component {
messages: [], messages: [],
fileLoading: true fileLoading: true
}; };
this.rid = props.navigation.getParam('rid'); this.rid = props.route.params?.rid;
this.t = props.navigation.getParam('t'); this.t = props.route.params?.t;
this.content = this.defineMessagesViewContent(props.navigation.getParam('name')); this.content = this.defineMessagesViewContent(props.route.params?.name);
} }
componentDidMount() { componentDidMount() {

View File

@ -64,6 +64,20 @@ const styles = StyleSheet.create({
}); });
class NewServerView extends React.Component { class NewServerView extends React.Component {
// static navigationOptions = ({ screenProps, navigation }) => {
// const previousServer = navigation.getParam('previousServer', null);
// const close = navigation.getParam('close', () => {});
// return {
// headerLeft: previousServer ? <CloseModalButton navigation={navigation} onPress={close} testID='new-server-view-close' /> : undefined,
// title: I18n.t('Workspaces'),
// ...themedHeader(screenProps.theme)
// };
// }
static navigationOptions = {
title: I18n.t('Workspaces')
}
static propTypes = { static propTypes = {
navigation: PropTypes.object, navigation: PropTypes.object,
theme: PropTypes.string, theme: PropTypes.string,
@ -345,18 +359,4 @@ const mapDispatchToProps = dispatch => ({
appStart: root => dispatch(appStartAction(root)) appStart: root => dispatch(appStartAction(root))
}); });
// static navigationOptions = ({ screenProps, navigation }) => {
// const previousServer = navigation.getParam('previousServer', null);
// const close = navigation.getParam('close', () => {});
// return {
// headerLeft: previousServer ? <CloseModalButton navigation={navigation} onPress={close} testID='new-server-view-close' /> : undefined,
// title: I18n.t('Workspaces'),
// ...themedHeader(screenProps.theme)
// };
// }
NewServerView.navigationOptions = {
title: I18n.t('Workspaces')
};
export default connect(mapStateToProps, mapDispatchToProps)(withTheme(NewServerView)); export default connect(mapStateToProps, mapDispatchToProps)(withTheme(NewServerView));

View File

@ -14,7 +14,6 @@ import scrollPersistTaps from '../../utils/scrollPersistTaps';
import styles from './styles'; import styles from './styles';
import RocketChat from '../../lib/rocketchat'; import RocketChat from '../../lib/rocketchat';
import { withTheme } from '../../theme'; import { withTheme } from '../../theme';
import { themedHeader } from '../../utils/navigation';
import protectedFunction from '../../lib/methods/helpers/protectedFunction'; import protectedFunction from '../../lib/methods/helpers/protectedFunction';
import SafeAreaView from '../../containers/SafeAreaView'; import SafeAreaView from '../../containers/SafeAreaView';
@ -139,21 +138,21 @@ const OPTIONS = {
}; };
class NotificationPreferencesView extends React.Component { class NotificationPreferencesView extends React.Component {
static navigationOptions = ({ screenProps }) => ({ static navigationOptions = {
title: I18n.t('Notification_Preferences'), title: I18n.t('Notification_Preferences')
...themedHeader(screenProps.theme) }
})
static propTypes = { static propTypes = {
navigation: PropTypes.object, navigation: PropTypes.object,
route: PropTypes.object,
theme: PropTypes.string theme: PropTypes.string
}; };
constructor(props) { constructor(props) {
super(props); super(props);
this.mounted = false; this.mounted = false;
this.rid = props.navigation.getParam('rid'); this.rid = props.route.params?.rid;
const room = props.navigation.getParam('room'); const room = props.route.params?.room;
this.state = { this.state = {
room: room || {} room: room || {}
}; };

View File

@ -16,6 +16,10 @@ import { withTheme } from '../../theme';
import FormContainer, { FormContainerInner } from '../../containers/FormContainer'; import FormContainer, { FormContainerInner } from '../../containers/FormContainer';
class OnboardingView extends React.Component { class OnboardingView extends React.Component {
static navigationOptions = {
headerShown: false
};
static propTypes = { static propTypes = {
navigation: PropTypes.object, navigation: PropTypes.object,
appStart: PropTypes.func, appStart: PropTypes.func,
@ -97,8 +101,4 @@ const mapDispatchToProps = dispatch => ({
appStart: root => dispatch(appStartAction(root)) appStart: root => dispatch(appStartAction(root))
}); });
OnboardingView.navigationOptions = {
headerShown: false
};
export default connect(null, mapDispatchToProps)(withTheme(OnboardingView)); export default connect(null, mapDispatchToProps)(withTheme(OnboardingView));

View File

@ -29,13 +29,11 @@ import { DrawerButton } from '../../containers/HeaderButton';
import StatusBar from '../../containers/StatusBar'; import StatusBar from '../../containers/StatusBar';
import { themes } from '../../constants/colors'; import { themes } from '../../constants/colors';
import { withTheme } from '../../theme'; import { withTheme } from '../../theme';
import { themedHeader } from '../../utils/navigation';
import { getUserSelector } from '../../selectors/login'; import { getUserSelector } from '../../selectors/login';
import SafeAreaView from '../../containers/SafeAreaView'; import SafeAreaView from '../../containers/SafeAreaView';
class ProfileView extends React.Component { class ProfileView extends React.Component {
static navigationOptions = ({ navigation, screenProps }) => ({ static navigationOptions = ({ navigation }) => ({
...themedHeader(screenProps.theme),
// headerLeft: screenProps.split ? ( // headerLeft: screenProps.split ? (
// <HeaderBackButton // <HeaderBackButton
// onPress={() => navigation.navigate('SettingsView')} // onPress={() => navigation.navigate('SettingsView')}
@ -44,6 +42,7 @@ class ProfileView extends React.Component {
// ) : ( // ) : (
// <DrawerButton navigation={navigation} /> // <DrawerButton navigation={navigation} />
// ), // ),
headerLeft: () => <DrawerButton navigation={navigation} />,
title: I18n.t('Profile') title: I18n.t('Profile')
}) })

View File

@ -12,19 +12,17 @@ import I18n from '../../i18n';
import RocketChat from '../../lib/rocketchat'; import RocketChat from '../../lib/rocketchat';
import StatusBar from '../../containers/StatusBar'; import StatusBar from '../../containers/StatusBar';
import { withTheme } from '../../theme'; import { withTheme } from '../../theme';
import { themedHeader } from '../../utils/navigation';
import { themes } from '../../constants/colors'; import { themes } from '../../constants/colors';
import { getUserSelector } from '../../selectors/login'; import { getUserSelector } from '../../selectors/login';
import SafeAreaView from '../../containers/SafeAreaView'; import SafeAreaView from '../../containers/SafeAreaView';
class ReadReceiptView extends React.Component { class ReadReceiptView extends React.Component {
static navigationOptions = ({ screenProps }) => ({ static navigationOptions = {
title: I18n.t('Read_Receipt'), title: I18n.t('Read_Receipt')
...themedHeader(screenProps.theme) }
})
static propTypes = { static propTypes = {
navigation: PropTypes.object, route: PropTypes.object,
Message_TimeFormat: PropTypes.string, Message_TimeFormat: PropTypes.string,
baseUrl: PropTypes.string, baseUrl: PropTypes.string,
user: PropTypes.object, user: PropTypes.object,
@ -33,7 +31,7 @@ class ReadReceiptView extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.messageId = props.navigation.getParam('messageId'); this.messageId = props.route.params?.messageId;
this.state = { this.state = {
loading: false, loading: false,
receipts: [] receipts: []

View File

@ -53,14 +53,10 @@ const styles = StyleSheet.create({
}); });
class RegisterView extends React.Component { class RegisterView extends React.Component {
static navigationOptions = ({ navigation, screenProps }) => { static navigatonOptions = ({ route, navigation }) => ({
const title = navigation.getParam('title', 'Rocket.Chat'); title: route.params.title,
return { headerRight: () => <LegalButton testID='register-view-more' navigation={navigation} />
...themedHeader(screenProps.theme), });
title,
headerRight: <LegalButton navigation={navigation} testID='register-view-more' />
};
}
static propTypes = { static propTypes = {
navigation: PropTypes.object, navigation: PropTypes.object,
@ -342,9 +338,4 @@ const mapDispatchToProps = dispatch => ({
loginRequest: params => dispatch(loginRequestAction(params)) loginRequest: params => dispatch(loginRequestAction(params))
}); });
RegisterView.navigatonOptions = ({ route, navigation }) => ({
title: route.params.title,
headerRight: () => <LegalButton testID='register-view-more' navigation={navigation} />
});
export default connect(mapStateToProps, mapDispatchToProps)(withTheme(RegisterView)); export default connect(mapStateToProps, mapDispatchToProps)(withTheme(RegisterView));

View File

@ -23,7 +23,6 @@ import DisclosureIndicator from '../../containers/DisclosureIndicator';
import StatusBar from '../../containers/StatusBar'; import StatusBar from '../../containers/StatusBar';
import { themes } from '../../constants/colors'; import { themes } from '../../constants/colors';
import { withTheme } from '../../theme'; import { withTheme } from '../../theme';
import { themedHeader } from '../../utils/navigation';
import { CloseModalButton } from '../../containers/HeaderButton'; import { CloseModalButton } from '../../containers/HeaderButton';
import { getUserSelector } from '../../selectors/login'; import { getUserSelector } from '../../selectors/login';
import Markdown from '../../containers/markdown'; import Markdown from '../../containers/markdown';
@ -31,20 +30,21 @@ import { showConfirmationAlert, showErrorAlert } from '../../utils/info';
import SafeAreaView from '../../containers/SafeAreaView'; import SafeAreaView from '../../containers/SafeAreaView';
class RoomActionsView extends React.Component { class RoomActionsView extends React.Component {
static navigationOptions = ({ navigation, screenProps }) => { static navigationOptions = () => {
const options = { const options = {
...themedHeader(screenProps.theme),
title: I18n.t('Actions') title: I18n.t('Actions')
}; };
if (screenProps.split) { // TODO: ?
options.headerLeft = <CloseModalButton navigation={navigation} testID='room-actions-view-close' />; // if (screenProps.split) {
} // options.headerLeft = <CloseModalButton navigation={navigation} testID='room-actions-view-close' />;
// }
return options; return options;
} }
static propTypes = { static propTypes = {
baseUrl: PropTypes.string, baseUrl: PropTypes.string,
navigation: PropTypes.object, navigation: PropTypes.object,
route: PropTypes.object,
user: PropTypes.shape({ user: PropTypes.shape({
id: PropTypes.string, id: PropTypes.string,
token: PropTypes.string token: PropTypes.string
@ -59,10 +59,10 @@ class RoomActionsView extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.mounted = false; this.mounted = false;
const room = props.navigation.getParam('room'); const room = props.route.params?.room;
const member = props.navigation.getParam('member'); const member = props.route.params?.member;
this.rid = props.navigation.getParam('rid'); this.rid = props.route.params?.rid;
this.t = props.navigation.getParam('t'); this.t = props.route.params?.t;
this.state = { this.state = {
room: room || { rid: this.rid, t: this.t }, room: room || { rid: this.rid, t: this.t },
membersCount: 0, membersCount: 0,

View File

@ -26,7 +26,6 @@ import random from '../../utils/random';
import log from '../../utils/log'; import log from '../../utils/log';
import I18n from '../../i18n'; import I18n from '../../i18n';
import StatusBar from '../../containers/StatusBar'; import StatusBar from '../../containers/StatusBar';
import { themedHeader } from '../../utils/navigation';
import { themes } from '../../constants/colors'; import { themes } from '../../constants/colors';
import { withTheme } from '../../theme'; import { withTheme } from '../../theme';
import { MultiSelect } from '../../containers/UIKit/MultiSelect'; import { MultiSelect } from '../../containers/UIKit/MultiSelect';
@ -49,13 +48,12 @@ const PERMISSIONS_ARRAY = [
]; ];
class RoomInfoEditView extends React.Component { class RoomInfoEditView extends React.Component {
static navigationOptions = ({ screenProps }) => ({ static navigationOptions = {
title: I18n.t('Room_Info_Edit'), title: I18n.t('Room_Info_Edit')
...themedHeader(screenProps.theme) }
})
static propTypes = { static propTypes = {
navigation: PropTypes.object, route: PropTypes.object,
deleteRoom: PropTypes.func, deleteRoom: PropTypes.func,
serverVersion: PropTypes.string, serverVersion: PropTypes.string,
theme: PropTypes.string theme: PropTypes.string
@ -101,8 +99,8 @@ class RoomInfoEditView extends React.Component {
// eslint-disable-next-line react/sort-comp // eslint-disable-next-line react/sort-comp
loadRoom = async() => { loadRoom = async() => {
const { navigation } = this.props; const { route } = this.props;
const rid = navigation.getParam('rid', null); const rid = route.params?.rid;
if (!rid) { if (!rid) {
return; return;
} }

View File

@ -1,9 +1,8 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { View, Text, ScrollView, SafeAreaView } from 'react-native'; import { View, Text, ScrollView } from 'react-native';
import { BorderlessButton } from 'react-native-gesture-handler'; import { BorderlessButton } from 'react-native-gesture-handler';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
// import { SafeAreaView } from 'react-navigation';
import UAParser from 'ua-parser-js'; import UAParser from 'ua-parser-js';
import _ from 'lodash'; import _ from 'lodash';
@ -22,7 +21,6 @@ import log from '../../utils/log';
import { themes } from '../../constants/colors'; import { themes } from '../../constants/colors';
import { withTheme } from '../../theme'; import { withTheme } from '../../theme';
import { withSplit } from '../../split'; import { withSplit } from '../../split';
import { themedHeader } from '../../utils/navigation';
import { getUserSelector } from '../../selectors/login'; import { getUserSelector } from '../../selectors/login';
import Markdown from '../../containers/markdown'; import Markdown from '../../containers/markdown';
import Navigation from '../../lib/Navigation'; import Navigation from '../../lib/Navigation';
@ -31,6 +29,7 @@ import Livechat from './Livechat';
import Channel from './Channel'; import Channel from './Channel';
import Item from './Item'; import Item from './Item';
import Direct from './Direct'; import Direct from './Direct';
import SafeAreaView from '../../containers/SafeAreaView';
const PERMISSION_EDIT_ROOM = 'edit-room'; const PERMISSION_EDIT_ROOM = 'edit-room';
const getRoomTitle = (room, type, name, username, statusText, theme) => (type === 'd' const getRoomTitle = (room, type, name, username, statusText, theme) => (type === 'd'
@ -50,15 +49,14 @@ const getRoomTitle = (room, type, name, username, statusText, theme) => (type ==
); );
class RoomInfoView extends React.Component { class RoomInfoView extends React.Component {
static navigationOptions = ({ navigation, screenProps }) => { static navigationOptions = ({ navigation, route }) => {
const t = navigation.getParam('t'); const t = route.params?.t;
const rid = navigation.getParam('rid'); const rid = route.params?.rid;
const room = navigation.getParam('room'); const room = route.params?.room;
const roomUser = navigation.getParam('roomUser'); const roomUser = route.params?.roomUser;
const showEdit = navigation.getParam('showEdit', t === 'l'); const showEdit = route.params?.showEdit;
return { return {
title: t === 'd' ? I18n.t('User_Info') : I18n.t('Room_Info'), title: t === 'd' ? I18n.t('User_Info') : I18n.t('Room_Info'),
...themedHeader(screenProps.theme),
headerRight: showEdit headerRight: showEdit
? ( ? (
<CustomHeaderButtons> <CustomHeaderButtons>
@ -75,6 +73,7 @@ class RoomInfoView extends React.Component {
static propTypes = { static propTypes = {
navigation: PropTypes.object, navigation: PropTypes.object,
route: PropTypes.object,
user: PropTypes.shape({ user: PropTypes.shape({
id: PropTypes.string, id: PropTypes.string,
token: PropTypes.string token: PropTypes.string
@ -87,10 +86,10 @@ class RoomInfoView extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
const room = props.navigation.getParam('room'); const room = props.route.params?.room;
const roomUser = props.navigation.getParam('member'); const roomUser = props.route.params?.member;
this.rid = props.navigation.getParam('rid'); this.rid = props.route.params?.rid;
this.t = props.navigation.getParam('t'); this.t = props.route.params?.t;
this.state = { this.state = {
room: room || { rid: this.rid, t: this.t }, room: room || { rid: this.rid, t: this.t },
roomUser: roomUser || {} roomUser: roomUser || {}
@ -327,8 +326,8 @@ class RoomInfoView extends React.Component {
<ScrollView style={[styles.scroll, { backgroundColor: themes[theme].backgroundColor }]}> <ScrollView style={[styles.scroll, { backgroundColor: themes[theme].backgroundColor }]}>
<StatusBar theme={theme} /> <StatusBar theme={theme} />
<SafeAreaView <SafeAreaView
style={[styles.container, { backgroundColor: themes[theme].backgroundColor }]} style={{ backgroundColor: themes[theme].backgroundColor }}
forceInset={{ vertical: 'never' }} theme={theme}
testID='room-info-view' testID='room-info-view'
> >
<View style={[styles.avatarContainer, this.isDirect && styles.avatarContainerDirectRoom, { backgroundColor: themes[theme].auxiliaryBackground }]}> <View style={[styles.avatarContainer, this.isDirect && styles.avatarContainerDirectRoom, { backgroundColor: themes[theme].auxiliaryBackground }]}>

View File

@ -21,7 +21,6 @@ import { CustomHeaderButtons, Item } from '../../containers/HeaderButton';
import StatusBar from '../../containers/StatusBar'; import StatusBar from '../../containers/StatusBar';
import ActivityIndicator from '../../containers/ActivityIndicator'; import ActivityIndicator from '../../containers/ActivityIndicator';
import { withTheme } from '../../theme'; import { withTheme } from '../../theme';
import { themedHeader } from '../../utils/navigation';
import { themes } from '../../constants/colors'; import { themes } from '../../constants/colors';
import { getUserSelector } from '../../selectors/login'; import { getUserSelector } from '../../selectors/login';
import SafeAreaView from '../../containers/SafeAreaView'; import SafeAreaView from '../../containers/SafeAreaView';
@ -29,13 +28,12 @@ import SafeAreaView from '../../containers/SafeAreaView';
const PAGE_SIZE = 25; const PAGE_SIZE = 25;
class RoomMembersView extends React.Component { class RoomMembersView extends React.Component {
static navigationOptions = ({ navigation, screenProps }) => { static navigationOptions = ({ route }) => {
const toggleStatus = navigation.getParam('toggleStatus', () => {}); const toggleStatus = route.params?.toggleStatus ?? (() => {});
const allUsers = navigation.getParam('allUsers'); const allUsers = route.params?.allUsers;
const toggleText = allUsers ? I18n.t('Online') : I18n.t('All'); const toggleText = allUsers ? I18n.t('Online') : I18n.t('All');
return { return {
title: I18n.t('Members'), title: I18n.t('Members'),
...themedHeader(screenProps.theme),
headerRight: ( headerRight: (
<CustomHeaderButtons> <CustomHeaderButtons>
<Item title={toggleText} onPress={toggleStatus} testID='room-members-view-toggle-status' /> <Item title={toggleText} onPress={toggleStatus} testID='room-members-view-toggle-status' />
@ -46,6 +44,7 @@ class RoomMembersView extends React.Component {
static propTypes = { static propTypes = {
navigation: PropTypes.object, navigation: PropTypes.object,
route: PropTypes.object,
rid: PropTypes.string, rid: PropTypes.string,
members: PropTypes.array, members: PropTypes.array,
baseUrl: PropTypes.string, baseUrl: PropTypes.string,
@ -63,8 +62,8 @@ class RoomMembersView extends React.Component {
this.CANCEL_INDEX = 0; this.CANCEL_INDEX = 0;
this.MUTE_INDEX = 1; this.MUTE_INDEX = 1;
this.actionSheetOptions = ['']; this.actionSheetOptions = [''];
const { rid } = props.navigation.state.params; const rid = props.route.params?.rid;
const room = props.navigation.getParam('room'); const room = props.route.params?.room;
this.state = { this.state = {
isLoading: false, isLoading: false,
allUsers: false, allUsers: false,

View File

@ -71,6 +71,67 @@ const stateAttrsUpdate = [
const roomAttrsUpdate = ['f', 'ro', 'blocked', 'blocker', 'archived', 'muted', 'jitsiTimeout', 'announcement', 'sysMes', 'topic', 'name', 'fname', 'roles', 'bannerClosed', 'visitor']; const roomAttrsUpdate = ['f', 'ro', 'blocked', 'blocker', 'archived', 'muted', 'jitsiTimeout', 'announcement', 'sysMes', 'topic', 'name', 'fname', 'roles', 'bannerClosed', 'visitor'];
class RoomView extends React.Component { class RoomView extends React.Component {
static navigationOptions = ({ navigation, route }) => {
const rid = route.params?.rid ?? null;
const prid = route.params?.prid;
const title = route.params?.name;
const subtitle = route.params?.subtitle;
const t = route.params?.t;
const tmid = route.params?.tmid;
const baseUrl = route.params?.baseUrl;
const userId = route.params?.userId;
const token = route.params?.token;
const avatar = route.params?.avatar;
const toggleFollowThread = route.params?.toggleFollowThread ?? (() => {});
const goRoomActionsView = route.params?.goRoomActionsView ?? (() => {});
const unreadsCount = route.params?.unreadsCount ?? null;
const roomUserId = route.params?.roomUserId;
const visitor = route.params?.visitor;
if (!rid) {
return {};
}
return {
headerTitle: () => (
<RoomHeaderView
rid={rid}
prid={prid}
tmid={tmid}
title={title}
subtitle={subtitle}
type={t}
widthOffset={tmid ? 95 : 130}
roomUserId={roomUserId}
visitor={visitor}
goRoomActionsView={goRoomActionsView}
/>
),
headerRight: () => (
<RightButtons
rid={rid}
tmid={tmid}
t={t}
navigation={navigation}
toggleFollowThread={toggleFollowThread}
/>
),
headerLeft: () => (
<RoomHeaderLeft
tmid={tmid}
unreadsCount={unreadsCount}
navigation={navigation}
baseUrl={baseUrl}
userId={userId}
token={token}
title={avatar}
theme='light' // TODO: ?
t={t}
goRoomActionsView={goRoomActionsView}
split={false} // TODO: ?
/>
)
};
}
static propTypes = { static propTypes = {
navigation: PropTypes.object, navigation: PropTypes.object,
route: PropTypes.object, route: PropTypes.object,
@ -1017,65 +1078,4 @@ const mapDispatchToProps = dispatch => ({
replyBroadcast: message => dispatch(replyBroadcastAction(message)) replyBroadcast: message => dispatch(replyBroadcastAction(message))
}); });
RoomView.navigationOptions = ({ navigation, route }) => {
const rid = route.params?.rid ?? null;
const prid = route.params?.prid;
const title = route.params?.name;
const subtitle = route.params?.subtitle;
const t = route.params?.t;
const tmid = route.params?.tmid;
const baseUrl = route.params?.baseUrl;
const userId = route.params?.userId;
const token = route.params?.token;
const avatar = route.params?.avatar;
const toggleFollowThread = route.params?.toggleFollowThread ?? (() => {});
const goRoomActionsView = route.params?.goRoomActionsView ?? (() => {});
const unreadsCount = route.params?.unreadsCount ?? null;
const roomUserId = route.params?.roomUserId;
const visitor = route.params?.visitor;
if (!rid) {
return {};
}
return {
headerTitle: () => (
<RoomHeaderView
rid={rid}
prid={prid}
tmid={tmid}
title={title}
subtitle={subtitle}
type={t}
widthOffset={tmid ? 95 : 130}
roomUserId={roomUserId}
visitor={visitor}
goRoomActionsView={goRoomActionsView}
/>
),
headerRight: () => (
<RightButtons
rid={rid}
tmid={tmid}
t={t}
navigation={navigation}
toggleFollowThread={toggleFollowThread}
/>
),
headerLeft: () => (
<RoomHeaderLeft
tmid={tmid}
unreadsCount={unreadsCount}
navigation={navigation}
baseUrl={baseUrl}
userId={userId}
token={token}
title={avatar}
theme='light' // TODO: ?
t={t}
goRoomActionsView={goRoomActionsView}
split={false} // TODO: ?
/>
)
};
};
export default connect(mapStateToProps, mapDispatchToProps)(withTheme(RoomView)); export default connect(mapStateToProps, mapDispatchToProps)(withTheme(RoomView));

View File

@ -99,6 +99,51 @@ const getItemLayout = (data, index) => ({
const keyExtractor = item => item.rid; const keyExtractor = item => item.rid;
class RoomsListView extends React.Component { class RoomsListView extends React.Component {
static navigationOptions = ({ route, navigation }) => {
const searching = route.params?.searching;
const cancelSearch = route.params?.cancelSearch ?? (() => {});
const onPressItem = route.params?.onPressItem ?? (() => {});
const initSearching = route.params?.initSearching ?? (() => {});
return {
headerLeft: () => (searching && isAndroid ? (
<CustomHeaderButtons left>
<Item
title='cancel'
iconName='cross'
onPress={cancelSearch}
/>
</CustomHeaderButtons>
) : (
<DrawerButton
navigation={navigation}
testID='rooms-list-view-sidebar'
/>
)),
headerTitle: () => <RoomsListHeaderView />,
headerRight: () => (searching && isAndroid ? null : (
<CustomHeaderButtons>
{isAndroid ? (
<Item
title='search'
iconName='magnifier'
onPress={initSearching}
/>
) : null}
<Item
title='new'
iconName='edit-rounded'
onPress={() => navigation.navigate('NewMessageStack', {
screen: 'NewMessageView',
params: { onPressItem }
})}
testID='rooms-list-view-create-channel'
/>
</CustomHeaderButtons>
))
};
}
static propTypes = { static propTypes = {
navigation: PropTypes.object, navigation: PropTypes.object,
user: PropTypes.shape({ user: PropTypes.shape({
@ -835,49 +880,4 @@ const mapDispatchToProps = dispatch => ({
closeServerDropdown: () => dispatch(closeServerDropdownAction()) closeServerDropdown: () => dispatch(closeServerDropdownAction())
}); });
RoomsListView.navigationOptions = ({ route, navigation }) => {
const searching = route.params?.searching;
const cancelSearch = route.params?.cancelSearch ?? (() => {});
const onPressItem = route.params?.onPressItem ?? (() => {});
const initSearching = route.params?.initSearching ?? (() => {});
return {
headerLeft: () => (searching && isAndroid ? (
<CustomHeaderButtons left>
<Item
title='cancel'
iconName='cross'
onPress={cancelSearch}
/>
</CustomHeaderButtons>
) : (
<DrawerButton
navigation={navigation}
testID='rooms-list-view-sidebar'
/>
)),
headerTitle: () => <RoomsListHeaderView />,
headerRight: () => (searching && isAndroid ? null : (
<CustomHeaderButtons>
{isAndroid ? (
<Item
title='search'
iconName='magnifier'
onPress={initSearching}
/>
) : null}
<Item
title='new'
iconName='edit-rounded'
onPress={() => navigation.navigate('NewMessageStack', {
screen: 'NewMessageView',
params: { onPressItem }
})}
testID='rooms-list-view-create-channel'
/>
</CustomHeaderButtons>
))
};
};
export default connect(mapStateToProps, mapDispatchToProps)(withTheme(withSplit(RoomsListView))); export default connect(mapStateToProps, mapDispatchToProps)(withTheme(withSplit(RoomsListView)));

View File

@ -17,18 +17,17 @@ import StatusBar from '../../containers/StatusBar';
import log from '../../utils/log'; import log from '../../utils/log';
import { themes } from '../../constants/colors'; import { themes } from '../../constants/colors';
import { withTheme } from '../../theme'; import { withTheme } from '../../theme';
import { themedHeader } from '../../utils/navigation';
import { getUserSelector } from '../../selectors/login'; import { getUserSelector } from '../../selectors/login';
import SafeAreaView from '../../containers/SafeAreaView'; import SafeAreaView from '../../containers/SafeAreaView';
class SearchMessagesView extends React.Component { class SearchMessagesView extends React.Component {
static navigationOptions = ({ screenProps }) => ({ static navigationOptions = {
title: I18n.t('Search'), title: I18n.t('Search')
...themedHeader(screenProps.theme) }
})
static propTypes = { static propTypes = {
navigation: PropTypes.object, navigation: PropTypes.object,
route: PropTypes.object,
user: PropTypes.object, user: PropTypes.object,
baseUrl: PropTypes.string, baseUrl: PropTypes.string,
customEmojis: PropTypes.object, customEmojis: PropTypes.object,
@ -42,7 +41,7 @@ class SearchMessagesView extends React.Component {
messages: [], messages: [],
searchText: '' searchText: ''
}; };
this.rid = props.navigation.getParam('rid'); this.rid = props.route.params?.rid;
} }
shouldComponentUpdate(nextProps, nextState) { shouldComponentUpdate(nextProps, nextState) {

View File

@ -19,7 +19,6 @@ import StatusBar from '../containers/StatusBar';
import { themes } from '../constants/colors'; import { themes } from '../constants/colors';
import { animateNextTransition } from '../utils/layoutAnimation'; import { animateNextTransition } from '../utils/layoutAnimation';
import { withTheme } from '../theme'; import { withTheme } from '../theme';
import { themedHeader } from '../utils/navigation';
import { getUserSelector } from '../selectors/login'; import { getUserSelector } from '../selectors/login';
import { import {
reset as resetAction, reset as resetAction,
@ -36,14 +35,13 @@ const styles = StyleSheet.create({
}); });
class SelectedUsersView extends React.Component { class SelectedUsersView extends React.Component {
static navigationOptions = ({ navigation, screenProps }) => { static navigationOptions = ({ route }) => {
const title = navigation.getParam('title', I18n.t('Select_Users')); const title = route.params?.title ?? I18n.t('Select_Users');
const buttonText = navigation.getParam('buttonText', I18n.t('Next')); const buttonText = route.params?.buttonText ?? I18n.t('Next');
const showButton = navigation.getParam('showButton', false); const showButton = route.params?.showButton ?? false;
const maxUsers = navigation.getParam('maxUsers'); const maxUsers = route.params?.maxUsers;
const nextAction = navigation.getParam('nextAction', () => {}); const nextAction = route.params?.nextAction ?? (() => {});
return { return {
...themedHeader(screenProps.theme),
title, title,
headerRight: ( headerRight: (
(!maxUsers || showButton) && ( (!maxUsers || showButton) && (
@ -69,6 +67,7 @@ class SelectedUsersView extends React.Component {
name: PropTypes.string name: PropTypes.string
}), }),
navigation: PropTypes.object, navigation: PropTypes.object,
route: PropTypes.object,
theme: PropTypes.string theme: PropTypes.string
}; };
@ -76,7 +75,7 @@ class SelectedUsersView extends React.Component {
super(props); super(props);
this.init(); this.init();
const maxUsers = props.navigation.getParam('maxUsers'); const maxUsers = props.route.params?.maxUsers;
this.state = { this.state = {
maxUsers, maxUsers,
search: [], search: [],

View File

@ -55,13 +55,12 @@ SectionSeparator.propTypes = {
}; };
class SettingsView extends React.Component { class SettingsView extends React.Component {
static navigationOptions = ({ navigation, screenProps }) => ({ static navigationOptions = ({ navigation, split }) => ({
...themedHeader(screenProps.theme), headerLeft: () => (split ? (
headerLeft: screenProps.split ? (
<CloseModalButton navigation={navigation} testID='settings-view-close' /> <CloseModalButton navigation={navigation} testID='settings-view-close' />
) : ( ) : (
<DrawerButton navigation={navigation} /> <DrawerButton navigation={navigation} />
), )),
title: I18n.t('Settings') title: I18n.t('Settings')
}); });

View File

@ -147,21 +147,21 @@ class Sidebar extends Component {
<SidebarItem <SidebarItem
text={I18n.t('Chats')} text={I18n.t('Chats')}
left={<CustomIcon name='message' size={20} color={themes[theme].titleText} />} left={<CustomIcon name='message' size={20} color={themes[theme].titleText} />}
onPress={() => this.sidebarNavigate('RoomsListView')} onPress={() => this.sidebarNavigate('ChatsStack')}
testID='sidebar-chats' testID='sidebar-chats'
current={activeItemKey === 'ChatsStack'} current={activeItemKey === 'ChatsStack'}
/> />
<SidebarItem <SidebarItem
text={I18n.t('Profile')} text={I18n.t('Profile')}
left={<CustomIcon name='user' size={20} color={themes[theme].titleText} />} left={<CustomIcon name='user' size={20} color={themes[theme].titleText} />}
onPress={() => this.sidebarNavigate('ProfileView')} onPress={() => this.sidebarNavigate('ProfileStack')}
testID='sidebar-profile' testID='sidebar-profile'
current={activeItemKey === 'ProfileStack'} current={activeItemKey === 'ProfileStack'}
/> />
<SidebarItem <SidebarItem
text={I18n.t('Settings')} text={I18n.t('Settings')}
left={<CustomIcon name='cog' size={20} color={themes[theme].titleText} />} left={<CustomIcon name='cog' size={20} color={themes[theme].titleText} />}
onPress={() => this.sidebarNavigate('SettingsView')} onPress={() => this.sidebarNavigate('SettingsStack')}
testID='sidebar-settings' testID='sidebar-settings'
current={activeItemKey === 'SettingsStack'} current={activeItemKey === 'SettingsStack'}
/> />
@ -169,7 +169,7 @@ class Sidebar extends Component {
<SidebarItem <SidebarItem
text={I18n.t('Admin_Panel')} text={I18n.t('Admin_Panel')}
left={<CustomIcon name='shield-alt' size={20} color={themes[theme].titleText} />} left={<CustomIcon name='shield-alt' size={20} color={themes[theme].titleText} />}
onPress={() => this.sidebarNavigate('AdminPanelView')} onPress={() => this.sidebarNavigate('AdminPanelStack')}
testID='sidebar-settings' testID='sidebar-settings'
current={activeItemKey === 'AdminPanelStack'} current={activeItemKey === 'AdminPanelStack'}
/> />
@ -200,7 +200,7 @@ class Sidebar extends Component {
return null; return null;
} }
return ( return (
<SafeAreaView testID='sidebar-view' style={{ backgroundColor: themes[theme].focusedBackground }} theme={theme}> <SafeAreaView testID='sidebar-view' style={{ backgroundColor: themes[theme].focusedBackground }} vertical={false} theme={theme}>
<ScrollView <ScrollView
style={[ style={[
styles.container, styles.container,

View File

@ -69,10 +69,9 @@ const styles = StyleSheet.create({
}); });
class ThemeView extends React.Component { class ThemeView extends React.Component {
static navigationOptions = ({ screenProps }) => ({ static navigationOptions = {
title: I18n.t('Theme'), title: I18n.t('Theme')
...themedHeader(screenProps.theme) }
})
static propTypes = { static propTypes = {
theme: PropTypes.string, theme: PropTypes.string,

View File

@ -22,7 +22,6 @@ import debounce from '../../utils/debounce';
import protectedFunction from '../../lib/methods/helpers/protectedFunction'; import protectedFunction from '../../lib/methods/helpers/protectedFunction';
import { themes } from '../../constants/colors'; import { themes } from '../../constants/colors';
import { withTheme } from '../../theme'; import { withTheme } from '../../theme';
import { themedHeader } from '../../utils/navigation';
import ModalNavigation from '../../lib/ModalNavigation'; import ModalNavigation from '../../lib/ModalNavigation';
import { getUserSelector } from '../../selectors/login'; import { getUserSelector } from '../../selectors/login';
import SafeAreaView from '../../containers/SafeAreaView'; import SafeAreaView from '../../containers/SafeAreaView';
@ -35,14 +34,14 @@ Separator.propTypes = {
const API_FETCH_COUNT = 50; const API_FETCH_COUNT = 50;
class ThreadMessagesView extends React.Component { class ThreadMessagesView extends React.Component {
static navigationOptions = ({ screenProps }) => ({ static navigationOptions = {
...themedHeader(screenProps.theme),
title: I18n.t('Threads') title: I18n.t('Threads')
}); }
static propTypes = { static propTypes = {
user: PropTypes.object, user: PropTypes.object,
navigation: PropTypes.object, navigation: PropTypes.object,
route: PropTypes.object,
baseUrl: PropTypes.string, baseUrl: PropTypes.string,
useRealName: PropTypes.bool, useRealName: PropTypes.bool,
theme: PropTypes.string, theme: PropTypes.string,
@ -53,8 +52,8 @@ class ThreadMessagesView extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.mounted = false; this.mounted = false;
this.rid = props.navigation.getParam('rid'); this.rid = props.route.params?.rid;
this.t = props.navigation.getParam('t'); this.t = props.route.params?.t;
this.state = { this.state = {
loading: false, loading: false,
end: false, end: false,

View File

@ -13,6 +13,10 @@ import ServerAvatar from './ServerAvatar';
import { getShowLoginButton } from '../../selectors/login'; import { getShowLoginButton } from '../../selectors/login';
class WorkspaceView extends React.Component { class WorkspaceView extends React.Component {
static navigationOptions = {
title: I18n.t('Your_workspace')
}
static propTypes = { static propTypes = {
navigation: PropTypes.object, navigation: PropTypes.object,
theme: PropTypes.string, theme: PropTypes.string,
@ -88,8 +92,4 @@ const mapStateToProps = state => ({
showLoginButton: getShowLoginButton(state) showLoginButton: getShowLoginButton(state)
}); });
WorkspaceView.navigationOptions = {
title: I18n.t('Your_workspace')
};
export default connect(mapStateToProps)(withTheme(WorkspaceView)); export default connect(mapStateToProps)(withTheme(WorkspaceView));