Changed Navigation to props.navigation

This commit is contained in:
Reinaldo Neto 2021-07-06 11:33:33 -03:00
parent 20ebc34b20
commit 986abe9a61
1 changed files with 57 additions and 52 deletions

View File

@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { CommonActions } from '@react-navigation/native';
import { Text, View, InteractionManager } from 'react-native'; import { Text, View, InteractionManager } from 'react-native';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import parse from 'url-parse'; import parse from 'url-parse';
@ -57,7 +58,6 @@ import RoomClass from '../../lib/methods/subscriptions/room';
import { getUserSelector } from '../../selectors/login'; import { getUserSelector } from '../../selectors/login';
import { CONTAINER_TYPES } from '../../lib/methods/actions'; import { CONTAINER_TYPES } from '../../lib/methods/actions';
import Banner from './Banner'; import Banner from './Banner';
import Navigation from '../../lib/Navigation';
import SafeAreaView from '../../containers/SafeAreaView'; import SafeAreaView from '../../containers/SafeAreaView';
import { withDimensions } from '../../dimensions'; import { withDimensions } from '../../dimensions';
import { getHeaderTitlePosition } from '../../containers/Header'; import { getHeaderTitlePosition } from '../../containers/Header';
@ -736,9 +736,10 @@ class RoomView extends React.Component {
} }
handleRoomRemoved = ({ rid }) => { handleRoomRemoved = ({ rid }) => {
const { navigation } = this.props;
const { room } = this.state; const { room } = this.state;
if (rid === this.rid) { if (rid === this.rid) {
Navigation.navigate('RoomsListView'); navigation.navigate('RoomsListView');
showErrorAlert(I18n.t('You_were_removed_from_channel', { channel: RocketChat.getRoomTitle(room) }), I18n.t('Oops')); showErrorAlert(I18n.t('You_were_removed_from_channel', { channel: RocketChat.getRoomTitle(room) }), I18n.t('Oops'));
} }
} }
@ -850,36 +851,38 @@ class RoomView extends React.Component {
}); });
} }
return Navigation.reset({ return navigation.dispatch(
index: 2, CommonActions.reset({
routes: [ index: 2,
{ routes: [
name: 'RoomsListView' {
}, name: 'RoomsListView'
{ },
name: 'RoomView', {
params: { name: 'RoomView',
rid: this.rid, params: {
name: item.name, rid: this.rid,
t: item.t, name: item.name,
prid: item.prid, t: item.t,
room: item, prid: item.prid,
visitor: item.visitor, room: item,
roomUserId visitor: item.visitor,
} roomUserId
}, }
{ },
name: 'RoomView', {
params: { name: 'RoomView',
rid: this.rid, params: {
tmid: item.tmid, rid: this.rid,
name, tmid: item.tmid,
t: 'thread', name,
roomUserId, t: 'thread',
jumpToMessageId: item.id roomUserId,
} jumpToMessageId: item.id
}] }
}); }]
})
);
} }
if (item.tlm) { if (item.tlm) {
@ -899,26 +902,28 @@ class RoomView extends React.Component {
}); });
} }
return Navigation.reset({ return navigation.dispatch(
index: 1, CommonActions.reset({
routes: [ index: 1,
{ routes: [
name: 'RoomsListView' {
}, name: 'RoomsListView'
{ },
name: 'RoomView', {
params: { name: 'RoomView',
rid: roomInfo.rid, params: {
name: RocketChat.getRoomTitle(roomInfo), rid: roomInfo.rid,
t: roomInfo.t, name: RocketChat.getRoomTitle(roomInfo),
prid: roomInfo.prid, t: roomInfo.t,
room: roomInfo, prid: roomInfo.prid,
visitor: roomInfo.visitor, room: roomInfo,
roomUserId: RocketChat.getUidDirectMessage(roomInfo), visitor: roomInfo.visitor,
jumpToMessageId: item.id roomUserId: RocketChat.getUidDirectMessage(roomInfo),
} jumpToMessageId: item.id
}] }
}); }]
})
);
} }
callJitsi = () => { callJitsi = () => {