diff --git a/app/api/token.js b/app/api/token.js
index 683080c..d33594e 100644
--- a/app/api/token.js
+++ b/app/api/token.js
@@ -10,4 +10,4 @@ async function set(token) {
return await AsyncStorage.setItem(STORAGE_KEY, token);
}
-export default { get, set };
+export default { get, set};
diff --git a/app/components/app.js b/app/components/app.js
index 79f7773..396f8e7 100644
--- a/app/components/app.js
+++ b/app/components/app.js
@@ -3,6 +3,7 @@ import React from 'react-native';
import RouteMaster from './routes/RouteMaster';
import RouteMapper from './navigation/RouteMapper';
import GlobalStyles from '../settings/styles';
+import BusyIndicator from 'react-native-busy-indicator';
const {
Navigator,
@@ -33,6 +34,7 @@ export default class extends React.Component {
nav={nav}
currentRoute={props.route}
{...props} />
+
);
}
diff --git a/app/components/projects/ProjectItem.js b/app/components/projects/ProjectItem.js
new file mode 100644
index 0000000..f0ac41b
--- /dev/null
+++ b/app/components/projects/ProjectItem.js
@@ -0,0 +1,15 @@
+import React from 'react-native';
+
+var {
+ View,
+ Text,
+ StyleSheet,
+} = React;
+
+export default class ProjectItem extends React.Component {
+ render() {
+ return (
+ {this.props.project.reponame}
+ );
+ }
+};
diff --git a/app/components/projects/ProjectList.js b/app/components/projects/ProjectList.js
new file mode 100644
index 0000000..bd1d60d
--- /dev/null
+++ b/app/components/projects/ProjectList.js
@@ -0,0 +1,49 @@
+import React from 'react-native';
+
+import ProjectItem from './ProjectItem';
+
+var {
+ ListView,
+ StyleSheet,
+ Text,
+ ScrollView
+} = React;
+
+var styles = StyleSheet.create({
+ composerListView: {
+ flex: 1,
+ flexDirection: 'row',
+ justifyContent: 'center',
+ flexWrap: 'wrap',
+ padding: 15
+ },
+});
+
+export default class ProjectList extends React.Component {
+ constructor(props) {
+ super(props);
+ const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
+ console.log(JSON.stringify(this.props.data));
+ this.state = {
+ dataSource: ds.cloneWithRows(this.props.data)
+ };
+ this.renderRow = this.renderRow.bind(this);
+ }
+
+ renderRow(project) {
+ return (
+
+ );
+ }
+
+ render() {
+ return (
+
+
+
+ );
+ }
+};
diff --git a/app/components/routes/home.js b/app/components/routes/home.js
index 3b9c556..352d4fa 100644
--- a/app/components/routes/home.js
+++ b/app/components/routes/home.js
@@ -1,27 +1,21 @@
import React from 'react-native';
import { getProjects } from '../../api/CircleCI';
+import loaderHandler from 'react-native-busy-indicator/LoaderHandler';
+import ProjectList from '../projects/ProjectList';
+import GlobalStyles from '../../settings/styles';
const {
StyleSheet,
Text,
View,
- ScrollView,
BackAndroid,
} = React;
const styles = StyleSheet.create({
container: {
flex: 1,
- backgroundColor: '#333',
+ backgroundColor: GlobalStyles.get('CIRCLE_BG'),
},
- contentWrapper: {
- flex: 0.85,
- justifyContent: 'flex-start',
- alignItems: 'center'
- },
- text: {
- color: 'white'
- }
});
export default class Home extends React.Component {
@@ -39,20 +33,30 @@ export default class Home extends React.Component {
componentWillMount() {
BackAndroid.addEventListener('hardwareBackPress', () => true);
+ loaderHandler.showLoader('Fetching Data');
}
componentDidMount() {
+ getProjects().then(function (data) {
+ this.setState({
+ projects: data
+ });
+ }.bind(this));
}
render() {
- const data = JSON.stringify(this.state.projects) || 'No Data';
+ let list;
+ if (this.state.projects) {
+ list = (
+
+ );
+ loaderHandler.hideLoader();
+ } else {
+ list = ( );
+ }
return (
-
-
- {data}
-
-
+ { list }
);
}
diff --git a/app/components/routes/info.js b/app/components/routes/info.js
index dcf7bbb..c75257b 100644
--- a/app/components/routes/info.js
+++ b/app/components/routes/info.js
@@ -16,7 +16,8 @@ const styles = StyleSheet.create({
},
contentWrapper: {
justifyContent: 'flex-start',
- alignItems: 'center'
+ alignItems: 'center',
+ padding: 10
},
text: {
color: GlobalStyles.get('CIRCLE_TEXT')
diff --git a/app/components/routes/login.js b/app/components/routes/login.js
index b8ef1fd..949487f 100644
--- a/app/components/routes/login.js
+++ b/app/components/routes/login.js
@@ -5,7 +5,6 @@ import RouteMaster from './RouteMaster';
import { checkToken } from '../../api/CircleCI';
import token from '../../api/token';
import loaderHandler from 'react-native-busy-indicator/LoaderHandler';
-import BusyIndicator from 'react-native-busy-indicator';
const dismissKeyboard = require('dismissKeyboard');
@@ -212,7 +211,6 @@ export default class Login extends React.Component {
-
);
}