2016-02-01 20:58:00 +00:00
|
|
|
import React from 'react-native';
|
|
|
|
|
2016-04-28 16:09:45 +01:00
|
|
|
import RouteMaster from './components/routes/RouteMaster';
|
|
|
|
import RouteMapper from './components/navigation/RouteMapper';
|
|
|
|
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-04-28 17:34:20 +01:00
|
|
|
import { Provider } from 'react-redux';
|
|
|
|
import configureStore from './store';
|
|
|
|
|
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-04-28 17:34:20 +01:00
|
|
|
const store = configureStore();
|
|
|
|
|
|
|
|
export default class App extends React.Component {
|
2016-02-01 20:58:00 +00:00
|
|
|
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-04-28 17:34:20 +01:00
|
|
|
<Provider store={store}>
|
|
|
|
<View style={{ flex: 1 }}>
|
|
|
|
<Navigator
|
|
|
|
renderScene={this.renderScene}
|
|
|
|
initialRoute={this.initialRoute}
|
|
|
|
navigationBar={
|
|
|
|
<Navigator.NavigationBar
|
|
|
|
style={styles.navbar}
|
|
|
|
routeMapper={RouteMapper} />
|
2016-03-11 20:53:33 +00:00
|
|
|
}
|
2016-04-28 17:34:20 +01:00
|
|
|
configureScene={(route) => {
|
|
|
|
if (route.sceneConfig) {
|
|
|
|
return route.sceneConfig;
|
|
|
|
}
|
|
|
|
return Navigator.SceneConfigs.PushFromRight;
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<BusyIndicator />
|
|
|
|
</View>
|
|
|
|
</Provider>
|
2016-02-01 20:58:00 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|