Skip to content

Commit

Permalink
Merge branch 'wookiem-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
bartonhammond committed Mar 8, 2016
2 parents 6b2fbe8 + 95e1365 commit 9d127c0
Show file tree
Hide file tree
Showing 26 changed files with 1,391 additions and 615 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ Snowflake ![snowflake](https://cloud.githubusercontent.com/assets/1282364/115993
[![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/bartonhammond/snowflake/blob/master/LICENSE)

---------------
Navigation is handled with [React Native Router Flux](https://github.com/aksonov/react-native-router-flux)

Using Redux and Immutable, the state of the application is fully testable with Jest, currently at 86% coverage.
Using [Redux](https://github.com/reactjs/react-redux) and [Immutable](https://facebook.github.io/immutable-js/), the state of the application is testable with Jest, currently at 80% coverage.

Snowflake supports Hot Reloading of its state. Snowflake uses CI with [Bitrise.io]( https://www.bitrise.io) and has extensive docs and 45+ min of video demonstating implementation.

Expand Down
2 changes: 1 addition & 1 deletion ios/Media.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,4 @@
"version" : 1,
"author" : "xcode"
}
}
}
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "snowflake",
"version": "0.0.11",
"version": "0.0.12",
"private": true,
"jest": {
"scriptPreprocessor": "jestSupport/scriptPreprocess.js",
Expand All @@ -20,6 +20,7 @@
"unmockedModulePathPatterns": [
"react",
"react-addons-test-utils",
"react-native-router-flux",
"promise",
"source-map",
"key-mirror",
Expand All @@ -29,6 +30,7 @@
"redux-thunk",
"fbjs"
],
"collectCoverage": false,
"verbose": true,
"testPathDirs": [
"src/"
Expand All @@ -47,9 +49,10 @@
"key-mirror": "^1.0.1",
"react-native": "^0.18.1",
"react-native-gifted-spinner": "0.0.3",
"react-native-navbar": "^1.2.1",
"react-native-router-flux": "^2.3.1",
"react-native-simple-store": "^0.1.0",
"react-native-simpledialog-android": "^1.0.2",
"react-native-tab-navigator": "^0.2.15",
"react-native-vector-icons": "^1.1.0",
"react-redux": "^4.1.1",
"redux": "^3.1.2",
Expand Down
7 changes: 7 additions & 0 deletions src/__mocks__/react-native-router-flux.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
Actions: {
push: function() {},
reset: function() {},
pop: function() {}
}
}
41 changes: 22 additions & 19 deletions src/components/LoginForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const {
* States of login display
*/
const {
LOGIN_STATE_REGISTER,
LOGIN_STATE_LOGIN,
LOGIN_STATE_FORGOT_PASSWORD
REGISTER,
LOGIN,
FORGOT_PASSWORD
} = require('../lib/constants').default;

/**
Expand All @@ -41,6 +41,7 @@ var LoginForm = React.createClass({
* * onChange: function to call when user enters text
*/
propTypes: {
formType: PropTypes.string,
form: PropTypes.object,
value: PropTypes.object,
onChange: PropTypes.func
Expand All @@ -54,6 +55,8 @@ var LoginForm = React.createClass({
*/
render() {

let formType = this.props.formType;

let options = {
auto: 'placeholders',
fields: {
Expand Down Expand Up @@ -98,12 +101,12 @@ var LoginForm = React.createClass({
};

let loginForm;
switch(this.props.form.state) {
switch(formType) {
/**
* ### Registration
* The registration form has 4 fields
*/
case(LOGIN_STATE_REGISTER):
case(REGISTER):
loginForm = t.struct({
username: t.String,
email: t.String,
Expand All @@ -120,20 +123,20 @@ var LoginForm = React.createClass({
* ### Login
* The login form has only 2 fields
*/
case(LOGIN_STATE_LOGIN):
case(LOGIN):
loginForm = t.struct({
username: t.String,
password: t.String
});
options.fields['username'] = username;
options.fields['password'] = password;
break;
/**
* ### Reset password
* The password reset form has only 1 field
*/
case(LOGIN_STATE_FORGOT_PASSWORD):
break;

/**
* ### Reset password
* The password reset form has only 1 field
*/
case(FORGOT_PASSWORD):
loginForm = t.struct({
email: t.String
});
Expand All @@ -146,12 +149,12 @@ var LoginForm = React.createClass({
* returns the Form component with the correct structures
*/
return (
<Form ref="form"
type={loginForm}
options={options}
value={this.props.value}
onChange={this.props.onChange}
/>
<Form ref="form"
type={loginForm}
options={options}
value={this.props.value}
onChange={this.props.onChange}
/>

);
}
Expand Down
Loading

0 comments on commit 9d127c0

Please sign in to comment.