2016-02-01 20:58:00 +00:00
|
|
|
import React from 'react-native';
|
|
|
|
|
|
|
|
import RouteMaster from './routes/RouteMaster';
|
2016-02-06 15:07:29 +00:00
|
|
|
import RouteMapper from './navigation/RouteMapper';
|
2016-02-06 15:49:57 +00:00
|
|
|
import GlobalStyles from '../settings/styles';
|
2016-02-21 12:05:14 +00:00
|
|
|
import BusyIndicator from 'react-native-busy-indicator';
|
2016-02-01 20:58:00 +00:00
|
|
|
|
2016-03-11 10:32:32 +00:00
|
|
|
require('moment-duration-format');
|
|
|
|
|
2016-02-01 20:58:00 +00:00
|
|
|
const {
|
|
|
|
Navigator,
|
2016-02-06 15:07:29 +00:00
|
|
|
StyleSheet,
|
|
|
|
Platform,
|
|
|
|
View
|
2016-02-01 20:58:00 +00:00
|
|
|
} = React;
|
|
|
|
|
2016-02-06 15:07:29 +00:00
|
|
|
const styles = StyleSheet.create({
|
|
|
|
navbar: {
|
2016-02-06 15:49:57 +00:00
|
|
|
backgroundColor: GlobalStyles.get('CIRCLE_NAVBAR_BG'),
|
2016-02-06 15:07:29 +00:00
|
|
|
flexDirection:'row',
|
|
|
|
justifyContent: 'center',
|
|
|
|
},
|
|
|
|
container: {
|
|
|
|
flex: 1,
|
|
|
|
marginTop: (Platform.OS === 'ios' ? 64 : 56)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-02-01 20:58:00 +00:00
|
|
|
export default class extends React.Component {
|
|
|
|
renderScene(route, nav) {
|
2016-02-06 15:07:29 +00:00
|
|
|
const Component = route.component;
|
2016-02-01 20:58:00 +00:00
|
|
|
const props = route.props || {};
|
2016-02-06 15:07:29 +00:00
|
|
|
return (
|
|
|
|
<View style={styles.container}>
|
|
|
|
<Component
|
|
|
|
nav={nav}
|
2016-02-23 23:12:32 +00:00
|
|
|
currentRoute={route}
|
2016-02-06 15:07:29 +00:00
|
|
|
{...props} />
|
|
|
|
</View>
|
|
|
|
);
|
2016-02-01 20:58:00 +00:00
|
|
|
}
|
|
|
|
|
2016-02-01 21:50:50 +00:00
|
|
|
componentWillMount() {
|
2016-02-01 20:58:00 +00:00
|
|
|
this.initialRoute = RouteMaster.get('LOGIN');
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
2016-03-11 20:53:33 +00:00
|
|
|
<View style={{ flex: 1 }}>
|
|
|
|
<Navigator
|
|
|
|
renderScene={this.renderScene}
|
|
|
|
initialRoute={this.initialRoute}
|
|
|
|
navigationBar={
|
|
|
|
<Navigator.NavigationBar
|
|
|
|
style={styles.navbar}
|
|
|
|
routeMapper={RouteMapper} />
|
2016-02-01 20:58:00 +00:00
|
|
|
}
|
2016-03-11 20:53:33 +00:00
|
|
|
configureScene={(route) => {
|
|
|
|
if (route.sceneConfig) {
|
|
|
|
return route.sceneConfig;
|
|
|
|
}
|
|
|
|
return Navigator.SceneConfigs.PushFromRight;
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<BusyIndicator />
|
|
|
|
</View>
|
2016-02-01 20:58:00 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|