diff --git a/app/containers/routes/AuthRoutes.js b/app/containers/routes/AuthRoutes.js index be582265..ed70deb7 100644 --- a/app/containers/routes/AuthRoutes.js +++ b/app/containers/routes/AuthRoutes.js @@ -1,6 +1,6 @@ import React from 'react'; import { Platform } from 'react-native'; -import { StackNavigator, DrawerNavigator, NavigationActions, HeaderBackButton } from 'react-navigation'; +import { StackNavigator, DrawerNavigator } from 'react-navigation'; import Sidebar from '../../containers/Sidebar'; import DrawerMenuButton from '../../presentation/DrawerMenuButton'; @@ -13,14 +13,6 @@ import SelectUsersView from '../../views/SelectUsersView'; const drawerPosition = 'left'; const drawerIconPosition = 'headerLeft'; -const backToScreen = (navigation, routeName) => { - const action = NavigationActions.reset({ - index: 0, - actions: [NavigationActions.navigate({ routeName })] - }); - navigation.dispatch(action); -}; - const AuthRoutes = StackNavigator( { RoomsList: { @@ -36,13 +28,7 @@ const AuthRoutes = StackNavigator( screen: RoomView, navigationOptions({ navigation }) { return { - title: navigation.state.params.title || 'Room', - headerLeft: ( - backToScreen(navigation, 'RoomsList')} - /> - ) + title: navigation.state.params.title || 'Room' // [drawerIconPosition]: ()รท }; } diff --git a/app/views/RoomsListView.js b/app/views/RoomsListView.js index 84d2e33a..aa4f3429 100644 --- a/app/views/RoomsListView.js +++ b/app/views/RoomsListView.js @@ -193,7 +193,7 @@ export default class RoomsListView extends React.Component { _onPressItem = (id, item = {}) => { const navigateToRoom = (room) => { - this.props.navigation.navigate('Room', { room }); + this.props.navigation.navigate('Room', { room, title: room.name }); }; const clearSearch = () => { @@ -220,7 +220,7 @@ export default class RoomsListView extends React.Component { } }); })) - .then(sub => navigateToRoom({ sid: sub._id })) + .then(sub => navigateToRoom({ sid: sub._id, name: sub.name })) .then(() => clearSearch()); } else { clearSearch(); @@ -229,7 +229,7 @@ export default class RoomsListView extends React.Component { return; } - navigateToRoom({ sid: id, ...item }); + navigateToRoom({ sid: id, name: item.name }); clearSearch(); }