[FIX] MessagesView title not working (#2294)

* Set title in header of room actions view items

Signed-off-by: Ezequiel De Oliveira <ezequiel1de1oliveira@gmail.com>

* Remove unneeded spaces

Signed-off-by: Ezequiel De Oliveira <ezequiel1de1oliveira@gmail.com>

* Set header title on constructor

Signed-off-by: Ezequiel De Oliveira <ezequiel1de1oliveira@gmail.com>

* Remove unused navigation options

Signed-off-by: Ezequiel De Oliveira <ezequiel1de1oliveira@gmail.com>

Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
Ezequiel de Oliveira 2020-07-24 16:58:14 -03:00 committed by GitHub
parent 5532d0f368
commit e5aaa667e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 7 deletions

View File

@ -112,7 +112,6 @@ const ChatsStackNavigator = () => {
<ChatsStack.Screen <ChatsStack.Screen
name='MessagesView' name='MessagesView'
component={MessagesView} component={MessagesView}
options={MessagesView.navigationOptions}
/> />
<ChatsStack.Screen <ChatsStack.Screen
name='AutoTranslateView' name='AutoTranslateView'

View File

@ -139,7 +139,6 @@ const ModalStackNavigator = React.memo(({ navigation }) => {
<ModalStack.Screen <ModalStack.Screen
name='MessagesView' name='MessagesView'
component={MessagesView} component={MessagesView}
options={MessagesView.navigationOptions}
/> />
<ModalStack.Screen <ModalStack.Screen
name='AutoTranslateView' name='AutoTranslateView'

View File

@ -18,10 +18,6 @@ import { withActionSheet } from '../../containers/ActionSheet';
import SafeAreaView from '../../containers/SafeAreaView'; import SafeAreaView from '../../containers/SafeAreaView';
class MessagesView extends React.Component { class MessagesView extends React.Component {
static navigationOptions = ({ route }) => ({
title: I18n.t(route.params?.name)
});
static propTypes = { static propTypes = {
user: PropTypes.object, user: PropTypes.object,
baseUrl: PropTypes.string, baseUrl: PropTypes.string,
@ -39,6 +35,7 @@ class MessagesView extends React.Component {
messages: [], messages: [],
fileLoading: true fileLoading: true
}; };
this.setHeader();
this.rid = props.route.params?.rid; this.rid = props.route.params?.rid;
this.t = props.route.params?.t; this.t = props.route.params?.t;
this.content = this.defineMessagesViewContent(props.route.params?.name); this.content = this.defineMessagesViewContent(props.route.params?.name);
@ -65,10 +62,16 @@ class MessagesView extends React.Component {
if (fileLoading !== nextState.fileLoading) { if (fileLoading !== nextState.fileLoading) {
return true; return true;
} }
return false; return false;
} }
setHeader = () => {
const { route, navigation } = this.props;
navigation.setOptions({
title: I18n.t(route.params?.name)
});
}
navToRoomInfo = (navParam) => { navToRoomInfo = (navParam) => {
const { navigation, user } = this.props; const { navigation, user } = this.props;
if (navParam.rid === user.id) { if (navParam.rid === user.id) {