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

52 lines
1.1 KiB
JavaScript
Raw Normal View History

2016-02-06 12:42:44 +00:00
import React from 'react-native';
2016-02-21 12:05:14 +00:00
import loaderHandler from 'react-native-busy-indicator/LoaderHandler';
import ProjectList from '../projects/ProjectList';
import GlobalStyles from '../../settings/styles';
2016-02-06 12:42:44 +00:00
2016-02-23 23:12:32 +00:00
2016-02-06 12:42:44 +00:00
const {
StyleSheet,
View,
BackAndroid,
} = React;
const styles = StyleSheet.create({
container: {
flex: 1,
2016-02-21 12:05:14 +00:00
backgroundColor: GlobalStyles.get('CIRCLE_BG'),
2016-02-06 12:42:44 +00:00
},
});
export default class Home extends React.Component {
2016-02-11 20:45:40 +00:00
constructor() {
super();
2016-03-11 11:53:55 +00:00
this.didReset = false;
2016-02-11 20:45:40 +00:00
}
2016-02-06 12:42:44 +00:00
componentWillUnmount() {
BackAndroid.removeEventListener('hardwareBackPress', () => true);
}
componentWillMount() {
BackAndroid.addEventListener('hardwareBackPress', () => true);
2016-03-13 21:43:35 +00:00
loaderHandler.showLoader('Fetching');
2016-02-06 12:42:44 +00:00
}
2016-02-11 20:45:40 +00:00
componentDidMount() {
2016-02-23 23:12:32 +00:00
this.props.nav.navigationContext.addListener('didfocus', function () {
2016-03-11 11:53:55 +00:00
if (!this.didReset) {
this.props.nav.immediatelyResetRouteStack([this.props.currentRoute]);
this.didReset = true;
}
2016-02-23 23:12:32 +00:00
}.bind(this));
2016-02-11 20:45:40 +00:00
}
2016-02-06 12:42:44 +00:00
render() {
return (
<View style={styles.container}>
<ProjectList nav={this.props.nav} />
2016-02-06 12:42:44 +00:00
</View>
);
}
};