diff --git a/app/actions/actionsTypes.js b/app/actions/actionsTypes.js
index ef66104a6..308c4baa6 100644
--- a/app/actions/actionsTypes.js
+++ b/app/actions/actionsTypes.js
@@ -9,7 +9,17 @@ function createRequestTypes(base, types = defaultTypes) {
}
// Login events
-export const LOGIN = createRequestTypes('LOGIN', [...defaultTypes, 'SET_TOKEN', 'SUBMIT']);
+export const LOGIN = createRequestTypes('LOGIN', [
+ ...defaultTypes,
+ 'SET_TOKEN',
+ 'SUBMIT',
+ 'REGISTER_SUBMIT',
+ 'REGISTER_REQUEST',
+ 'REGISTER_SUCCESS',
+ 'SET_USERNAME_SUBMIT',
+ 'SET_USERNAME_REQUEST',
+ 'SET_USERNAME_SUCCESS'
+]);
export const ROOMS = createRequestTypes('ROOMS');
export const APP = createRequestTypes('APP', ['READY', 'INIT']);
export const MESSAGES = createRequestTypes('MESSAGES');
diff --git a/app/actions/login.js b/app/actions/login.js
index 7969c8090..1a8f753e8 100644
--- a/app/actions/login.js
+++ b/app/actions/login.js
@@ -13,6 +13,46 @@ export function loginRequest(credentials) {
};
}
+
+export function registerSubmit(credentials) {
+ return {
+ type: types.LOGIN.REGISTER_SUBMIT,
+ credentials
+ };
+}
+export function registerRequest(credentials) {
+ return {
+ type: types.LOGIN.REGISTER_REQUEST,
+ credentials
+ };
+}
+export function registerSuccess(credentials) {
+ return {
+ type: types.LOGIN.REGISTER_SUCCESS,
+ credentials
+ };
+}
+
+export function setUsernameSubmit(credentials) {
+ return {
+ type: types.LOGIN.SET_USERNAME_SUBMIT,
+ credentials
+ };
+}
+
+export function setUsernameRequest(credentials) {
+ return {
+ type: types.LOGIN.SET_USERNAME_REQUEST,
+ credentials
+ };
+}
+
+export function setUsernameSuccess() {
+ return {
+ type: types.LOGIN.SET_USERNAME_SUCCESS
+ };
+}
+
export function loginSuccess(user) {
return {
type: types.LOGIN.SUCCESS,
diff --git a/app/containers/Routes.js b/app/containers/Routes.js
index 485dd389d..83268096c 100644
--- a/app/containers/Routes.js
+++ b/app/containers/Routes.js
@@ -1,15 +1,12 @@
import PropTypes from 'prop-types';
import React from 'react';
-import { View, Image } from 'react-native';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
-import * as Animatable from 'react-native-animatable';
import { appInit } from '../actions';
-import styles from '../views/Styles';
-
import AuthRoutes from './routes/AuthRoutes';
import PublicRoutes from './routes/PublicRoutes';
+import Loading from '../presentation/Loading';
@connect(
state => ({
@@ -34,21 +31,10 @@ export default class Routes extends React.Component {
const { login, app } = this.props;
if (app.starting) {
- return (
-
-
-
-
-
- );
+ return ();
}
- if ((login.token && !login.failure) || app.ready) {
+ if ((login.token && !login.failure && !login.isRegistering) || app.ready) {
return ();
}
diff --git a/app/containers/routes/AuthRoutes.js b/app/containers/routes/AuthRoutes.js
index 6bef85455..2c1a9f35e 100644
--- a/app/containers/routes/AuthRoutes.js
+++ b/app/containers/routes/AuthRoutes.js
@@ -1,7 +1,5 @@
import React from 'react';
-import { Button } from 'react-native';
-import { StackNavigator, DrawerNavigator, NavigationActions } from 'react-navigation';
-// import { Platform } from 'react-native';
+import { StackNavigator, DrawerNavigator, NavigationActions, HeaderBackButton } from 'react-navigation';
import Sidebar from '../../containers/Sidebar';
import DrawerMenuButton from '../../presentation/DrawerMenuButton';
@@ -39,7 +37,10 @@ const AuthRoutes = StackNavigator(
return {
title: navigation.state.params.title || 'Room',
headerLeft: (
-