Compare commits

...

6 Commits

3 changed files with 34 additions and 5 deletions

View File

@ -16,10 +16,15 @@ function replace(name, params) {
navigationRef.current?.dispatch(StackActions.replace(name, params));
}
function reset({ index, routes }) {
navigationRef.current?.dispatch(CommonActions.reset({ index, routes }));
}
export default {
navigationRef,
routeNameRef,
navigate,
back,
replace
replace,
reset
};

View File

@ -2,10 +2,35 @@ import Navigation from '../lib/Navigation';
import RocketChat from '../lib/rocketchat';
const navigate = ({ item, isMasterDetail, ...props }) => {
let navigationMethod = props.navigationMethod ?? Navigation.navigate;
const navigationMethod = props.navigationMethod ?? Navigation.navigate;
if (isMasterDetail) {
navigationMethod = Navigation.replace;
return Navigation.reset({
index: 0,
routes: [
{
name: 'ChatsStackNavigator',
state: {
routes: [
{
name: 'RoomView',
params: {
rid: item.rid,
name: RocketChat.getRoomTitle(item),
t: item.t,
prid: item.prid,
room: item,
visitor: item.visitor,
roomUserId: RocketChat.getUidDirectMessage(item),
...props
}
}
]
}
}
]
});
}
navigationMethod('RoomView', {

View File

@ -726,8 +726,7 @@ class RoomsListView extends React.Component {
goRoom = ({ item, isMasterDetail }) => {
logEvent(events.RL_GO_ROOM);
const { item: currentItem } = this.state;
const { rooms } = this.props;
if (currentItem?.rid === item.rid || rooms?.includes(item.rid)) {
if (currentItem?.rid === item.rid) {
return;
}
// Only mark room as focused when in master detail layout