This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
Sphere/app/components/routes/home.js

60 lines
1.1 KiB
JavaScript
Raw Normal View History

2016-02-06 12:42:44 +00:00
import React from 'react-native';
2016-02-11 20:45:40 +00:00
import { getProjects } from '../../api/CircleCI';
2016-02-06 12:42:44 +00:00
const {
StyleSheet,
Text,
View,
ScrollView,
BackAndroid,
} = React;
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#333',
},
contentWrapper: {
flex: 0.85,
justifyContent: 'flex-start',
alignItems: 'center'
},
text: {
color: 'white'
}
});
export default class Home extends React.Component {
2016-02-11 20:45:40 +00:00
constructor() {
super();
this.state = {
projects: ''
};
}
2016-02-06 12:42:44 +00:00
componentWillUnmount() {
BackAndroid.removeEventListener('hardwareBackPress', () => true);
}
componentWillMount() {
BackAndroid.addEventListener('hardwareBackPress', () => true);
}
2016-02-11 20:45:40 +00:00
componentDidMount() {
}
2016-02-06 12:42:44 +00:00
render() {
2016-02-14 19:19:11 +00:00
const data = JSON.stringify(this.state.projects) || 'No Data';
2016-02-06 12:42:44 +00:00
return (
<View style={styles.container}>
<ScrollView keyboardShouldPersistTaps={false} contentContainerStyle={styles.container}>
<View style={styles.contentWrapper}>
2016-02-11 20:45:40 +00:00
<Text style={styles.text}>{data}</Text>
2016-02-06 12:42:44 +00:00
</View>
</ScrollView>
</View>
);
}
};