Skip to content

Commit

Permalink
Merge pull request #650 from charpeni/circleci
Browse files Browse the repository at this point in the history
Fix eslint issues and add circle.yml
  • Loading branch information
aksonov committed May 9, 2016
2 parents cad9467 + f4cd961 commit 7cf0180
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 9 deletions.
15 changes: 15 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
machine:
node:
version: 5.11.1
dependencies:
override:
- npm install
test:
pre:
- mkdir -p $CIRCLE_TEST_REPORTS/mocha
- touch $CIRCLE_TEST_REPORTS/mocha/junit.xml
- mkdir -p $CIRCLE_TEST_REPORTS/eslint
- touch $CIRCLE_TEST_REPORTS/eslint/eslint.xml
override:
- eslint index.js src/ test/ -o $CIRCLE_TEST_REPORTS/eslint/eslint.xml -f junit
- npm test -- --reporter xunit > $CIRCLE_TEST_REPORTS/mocha/junit.xml
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"main": "index.js",
"scripts": {
"test": "mocha --compilers js:babel-core/register --require react-native-mock/mock",
"test:watch": "npm run test -- --watch"
"test:watch": "npm run test -- --watch",
"eslint": "eslint index.js src/ test/ Example/*.js Example/components/; exit 0;"
},
"keywords": [
"react-native",
Expand Down
9 changes: 8 additions & 1 deletion src/Reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*
*/

/* eslint-disable no-param-reassign */

import {
PUSH_ACTION,
POP_ACTION2,
Expand Down Expand Up @@ -96,7 +98,12 @@ function inject(state, action, props, scenes) {
return state;
}

state.children[state.children.length - 1] = getInitialState(props, scenes, state.index, action);
state.children[state.children.length - 1] = getInitialState(
props,
scenes,
state.index,
action
);

return { ...state, children: state.children };
case RESET_ACTION:
Expand Down
19 changes: 12 additions & 7 deletions src/TabBar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import React, {
Component,
} from 'react';
import React, { PropTypes } from 'react';
import { View, NavigationExperimental } from 'react-native';
import Tabs from 'react-native-tabs';
import DefaultRenderer from './DefaultRenderer';
Expand All @@ -9,9 +7,12 @@ const {
View: NavigationView,
} = NavigationExperimental;

const propTypes = {
navigationState: PropTypes.object,
tabIcon: PropTypes.any,
};

export default class extends Component {

class TabBar extends React.Component {
constructor(props) {
super(props);
this.onSelect = this.onSelect.bind(this);
Expand All @@ -21,8 +22,8 @@ export default class extends Component {
onSelect(el) {
if (!Actions[el.props.name]) {
throw new Error(
'No action is defined for name=' + el.props.name +
' actions:' + JSON.stringify(Object.keys(Actions)));
`No action is defined for name=${el.props.name} ` +
`actions: ${JSON.stringify(Object.keys(Actions))}`);
}
Actions[el.props.name]();
}
Expand Down Expand Up @@ -73,3 +74,7 @@ export default class extends Component {
);
}
}

TabBar.propTypes = propTypes;

export default TabBar;

0 comments on commit 7cf0180

Please sign in to comment.