Small refactor

This commit is contained in:
Gerzon Z 2021-06-23 17:02:22 -04:00
parent daf7a3e02a
commit f47a1a922c
2 changed files with 8 additions and 9 deletions

View File

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

View File

@ -10,7 +10,6 @@ import { Q } from '@nozbe/watermelondb';
import { dequal } from 'dequal'; import { dequal } from 'dequal';
import { withSafeAreaInsets } from 'react-native-safe-area-context'; import { withSafeAreaInsets } from 'react-native-safe-area-context';
import { CommonActions } from '@react-navigation/native';
import Touch from '../../utils/touch'; import Touch from '../../utils/touch';
import { import {
replyBroadcast as replyBroadcastAction replyBroadcast as replyBroadcastAction
@ -844,7 +843,7 @@ class RoomView extends React.Component {
name = I18n.t('Encrypted_message'); name = I18n.t('Encrypted_message');
} }
const reset = CommonActions.reset({ return Navigation.reset({
index: 2, index: 2,
routes: [ routes: [
{ {
@ -874,8 +873,6 @@ class RoomView extends React.Component {
} }
}] }]
}); });
return navigation.dispatch(reset);
} }
if (item.tlm) { if (item.tlm) {
@ -886,10 +883,9 @@ class RoomView extends React.Component {
} }
navToRoom = async(item) => { navToRoom = async(item) => {
const { navigation } = this.props;
const roomInfo = await getRoomInfo(item.rid); const roomInfo = await getRoomInfo(item.rid);
const reset = CommonActions.reset({ return Navigation.reset({
index: 1, index: 1,
routes: [ routes: [
{ {
@ -909,8 +905,6 @@ class RoomView extends React.Component {
} }
}] }]
}); });
return navigation.dispatch(reset);
} }
callJitsi = () => { callJitsi = () => {