diff --git a/app/actions/actionsTypes.js b/app/actions/actionsTypes.js
index 0aca1440..ef66104a 100644
--- a/app/actions/actionsTypes.js
+++ b/app/actions/actionsTypes.js
@@ -1,11 +1,10 @@
-
const REQUEST = 'REQUEST';
const SUCCESS = 'SUCCESS';
const FAILURE = 'FAILURE';
const defaultTypes = [REQUEST, SUCCESS, FAILURE];
function createRequestTypes(base, types = defaultTypes) {
const res = {};
- types.forEach(type => res[type] = `${ base }_${ type }`);
+ types.forEach(type => (res[type] = `${ base }_${ type }`));
return res;
}
@@ -14,7 +13,16 @@ export const LOGIN = createRequestTypes('LOGIN', [...defaultTypes, 'SET_TOKEN',
export const ROOMS = createRequestTypes('ROOMS');
export const APP = createRequestTypes('APP', ['READY', 'INIT']);
export const MESSAGES = createRequestTypes('MESSAGES');
-export const CREATE_CHANNEL = createRequestTypes('CREATE_CHANNEL', [...defaultTypes, 'REQUEST_USERS', 'SUCCESS_USERS', 'FAILURE_USERS', 'SET_USERS']);
+export const CREATE_CHANNEL = createRequestTypes('CREATE_CHANNEL', [
+ ...defaultTypes,
+ 'REQUEST_USERS',
+ 'SUCCESS_USERS',
+ 'FAILURE_USERS',
+ 'SET_USERS',
+ 'ADD_USER',
+ 'REMOVE_USER',
+ 'RESET'
+]);
export const NAVIGATION = createRequestTypes('NAVIGATION', ['SET']);
export const SERVER = createRequestTypes('SERVER', [...defaultTypes, 'SELECT', 'CHANGED', 'ADD']);
export const METEOR = createRequestTypes('METEOR_CONNECT', [...defaultTypes, 'DISCONNECT']);
diff --git a/app/actions/createChannel.js b/app/actions/createChannel.js
index df4cad35..435a42dd 100644
--- a/app/actions/createChannel.js
+++ b/app/actions/createChannel.js
@@ -21,7 +21,6 @@ export function createChannelFailure(err) {
};
}
-
export function createChannelRequestUsers(data) {
return {
type: types.CREATE_CHANNEL.REQUEST_USERS,
@@ -49,3 +48,23 @@ export function createChannelFailureUsers(err) {
err
};
}
+
+export function addUser(user) {
+ return {
+ type: types.CREATE_CHANNEL.ADD_USER,
+ user
+ };
+}
+
+export function removeUser(user) {
+ return {
+ type: types.CREATE_CHANNEL.REMOVE_USER,
+ user
+ };
+}
+
+export function reset() {
+ return {
+ type: types.CREATE_CHANNEL.RESET
+ };
+}
diff --git a/app/containers/routes/AuthRoutes.js b/app/containers/routes/AuthRoutes.js
index 47164192..6bef8545 100644
--- a/app/containers/routes/AuthRoutes.js
+++ b/app/containers/routes/AuthRoutes.js
@@ -1,5 +1,6 @@
import React from 'react';
-import { StackNavigator, DrawerNavigator } from 'react-navigation';
+import { Button } from 'react-native';
+import { StackNavigator, DrawerNavigator, NavigationActions } from 'react-navigation';
// import { Platform } from 'react-native';
import Sidebar from '../../containers/Sidebar';
@@ -8,10 +9,18 @@ import DrawerMenuButton from '../../presentation/DrawerMenuButton';
import RoomsListView from '../../views/RoomsListView';
import RoomView from '../../views/RoomView';
import CreateChannelView from '../../views/CreateChannelView';
+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(
{
@@ -20,7 +29,7 @@ const AuthRoutes = StackNavigator(
navigationOptions({ navigation }) {
return {
title: 'Rooms',
- [drawerIconPosition]: ()
+ [drawerIconPosition]:
};
}
},
@@ -28,7 +37,10 @@ const AuthRoutes = StackNavigator(
screen: RoomView,
navigationOptions({ navigation }) {
return {
- title: navigation.state.params.title || 'Room'
+ title: navigation.state.params.title || 'Room',
+ headerLeft: (
+