From ed1448b864f9ef777b852e9586f12c0dc2918901 Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Thu, 23 Nov 2017 17:12:06 -0200 Subject: [PATCH] =?UTF-8?q?Change=20Room=E2=80=99s=20back=20button=20text?= =?UTF-8?q?=20to=20previews=20screen=20title=20(#112)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #108 --- app/containers/routes/AuthRoutes.js | 18 ++---------------- app/views/RoomsListView.js | 6 +++--- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/app/containers/routes/AuthRoutes.js b/app/containers/routes/AuthRoutes.js index be5822652..ed70deb74 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 84d2e33a1..aa4f3429f 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(); }