11/**
22 * # Login.js
3- *
3+ *
44 * This class is a little complicated as it handles multiple states.
55 *
66 */
77'use strict' ;
88/**
99 * ## Imports
10- *
11- * Redux
10+ *
11+ * Redux
1212 */
1313import { bindActionCreators } from 'redux' ;
1414import { connect } from 'react-redux' ;
@@ -21,7 +21,7 @@ import * as globalActions from '../reducers/global/globalActions';
2121
2222/**
2323 * Immutable
24- */
24+ */
2525import { Map } from 'immutable' ;
2626
2727/**
@@ -47,7 +47,7 @@ import FormButton from '../components/FormButton';
4747 */
4848import LoginForm from '../components/LoginForm' ;
4949/**
50- * The itemCheckbox will toggle the display of the password fields
50+ * The itemCheckbox will toggle the display of the password fields
5151 */
5252import ItemCheckbox from '../components/ItemCheckbox' ;
5353
@@ -107,11 +107,6 @@ const actions = [
107107 globalActions
108108] ;
109109
110- function mapStateToProps ( state ) {
111- return {
112- } ;
113- }
114-
115110function mapDispatchToProps ( dispatch ) {
116111 const creators = Map ( )
117112 . merge ( ...actions )
@@ -144,7 +139,7 @@ class LoginRender extends Component {
144139 }
145140 } ;
146141 }
147-
142+
148143 /**
149144 * ### componentWillReceiveProps
150145 * As the properties are validated they will be set here.
@@ -159,7 +154,7 @@ class LoginRender extends Component {
159154 }
160155 } ) ;
161156 }
162-
157+
163158 /**
164159 * ### onChange
165160 *
@@ -172,7 +167,7 @@ class LoginRender extends Component {
172167 onChange ( value ) {
173168 if ( value . username != '' ) {
174169 this . props . actions . onAuthFormFieldChange ( 'username' , value . username ) ;
175- }
170+ }
176171 if ( value . email != '' ) {
177172 this . props . actions . onAuthFormFieldChange ( 'email' , value . email ) ;
178173 }
@@ -209,29 +204,29 @@ class LoginRender extends Component {
209204 } } >
210205 < Text > { I18n . t ( "LoginRender.already_have_account" ) } </ Text >
211206 </ TouchableHighlight > ;
212-
207+
213208 let register =
214- < TouchableHighlight
209+ < TouchableHighlight
215210 onPress = { ( ) => {
216211 actions . registerState ( ) ;
217212 Actions . Register ( ) ;
218213 } } >
219214 < Text > { I18n . t ( "LoginRender.register" ) } </ Text >
220215 </ TouchableHighlight > ;
221-
216+
222217 switch ( messageType ) {
223218 case FORGOT_PASSWORD :
224219 return forgotPassword ;
225220 case LOGIN :
226221 return alreadyHaveAccount ;
227- case REGISTER :
222+ case REGISTER :
228223 return register ;
229224 }
230225 }
231-
226+
232227 /**
233228 * ### render
234- * Setup some default presentations and render
229+ * Setup some default presentations and render
235230 */
236231 render ( ) {
237232 var formType = this . props . formType ;
@@ -240,16 +235,16 @@ class LoginRender extends Component {
240235 var displayPasswordCheckbox = this . props . displayPasswordCheckbox ;
241236 var leftMessageType = this . props . leftMessageType ;
242237 var rightMessageType = this . props . rightMessageType ;
243-
238+
244239 var passwordCheckbox = < Text /> ;
245240 let leftMessage = this . getMessage ( leftMessageType , this . props . actions ) ;
246241 let rightMessage = this . getMessage ( rightMessageType , this . props . actions ) ;
247-
242+
248243 let self = this ;
249244
250245 // display the login / register / change password screens
251246 this . errorAlert . checkError ( this . props . auth . form . error ) ;
252-
247+
253248 /**
254249 * Toggle the display of the Password and PasswordAgain fields
255250 */
@@ -270,11 +265,11 @@ class LoginRender extends Component {
270265 /**
271266 * The LoginForm is now defined with the required fields. Just
272267 * surround it with the Header and the navigation messages
273- * Note how the button too is disabled if we're fetching. The
274- * header props are mostly for support of Hot reloading.
268+ * Note how the button too is disabled if we're fetching. The
269+ * header props are mostly for support of Hot reloading.
275270 * See the docs for Header for more info.
276271 */
277-
272+
278273 return (
279274 < View style = { styles . container } >
280275 < ScrollView horizontal = { false } width = { width } height = { height } >
@@ -283,9 +278,9 @@ class LoginRender extends Component {
283278 showState = { this . props . global . showState }
284279 currentState = { this . props . global . currentState }
285280 onGetState = { this . props . actions . getState }
286- onSetState = { this . props . actions . setState }
281+ onSetState = { this . props . actions . setState }
287282 />
288-
283+
289284 < View style = { styles . inputs } >
290285 < LoginForm
291286 formType = { formType }
@@ -295,23 +290,23 @@ class LoginRender extends Component {
295290 />
296291 { passwordCheckbox }
297292 </ View >
298-
293+
299294 < FormButton
300295 isDisabled = { ! this . props . auth . form . isValid || this . props . auth . form . isFetching }
301296 onPress = { onButtonPress }
302297 buttonText = { loginButtonText } />
303-
298+
304299 < View >
305300 < View style = { styles . forgotContainer } >
306301 { leftMessage }
307302 { rightMessage }
308303 </ View >
309- </ View >
310-
304+ </ View >
305+
311306 </ View >
312307 </ ScrollView >
313308 </ View >
314309 ) ;
315310 }
316311}
317- export default connect ( mapStateToProps , mapDispatchToProps ) ( LoginRender ) ;
312+ export default connect ( null , mapDispatchToProps ) ( LoginRender ) ;
0 commit comments