ilink-world/qApp.android.js

276 lines
8.9 KiB
JavaScript
Raw Permalink Normal View History

/* eslint-disable prettier/prettier */
2019-06-16 13:09:54 +00:00
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
2021-02-25 18:47:49 +00:00
import {
createSwitchNavigator,
createStackNavigator,
createDrawerNavigator,
createAppContainer,
createBottomTabNavigator,
2021-02-25 18:47:49 +00:00
} from 'react-navigation';
import Connect from './screens/login/Connect';
import SplashScreen from './screens/splashscreen/SplashScreen';
import HelpMenu from './screens/help/HelpMenu';
import Help from './screens/help/Help';
import ForgottenPassword from './screens/login/ForgottenPassword';
import TypeChoiser from './screens/login/TypeChoiser';
import CreateUserStep2 from './screens/login/createUserStep2';
import createAccount from './screens/login/createAccount';
import UpdateInformations from './screens/account/UpdateInformations';
import UserAccount from './screens/account/UserAccount';
import ActivateAccount from './screens/login/ActivateAccount';
import Notifications from './screens/notifications/Notifications';
import About from './screens/configurations/About';
import Configurations from './screens/configurations/Configurations';
2019-06-16 13:09:54 +00:00
import History from './screens/history-request/History';
import OptionsMenu from './screens/optionMenu/OptionsMenu';
import Home from './screens/home/Home';
import HistoryItemDetails from './screens/history-request/HistoryItemDetails';
import SuperViseurGroupeHome from './screens/groupes/SuperViseurGroupeHome';
import HistoryRequester from './screens/history-request/HistoryRequester';
import AddNetwork from './screens/account/AddNetwork';
import MyHistory from './screens/history-request/MyHistory';
import Icon from 'react-native-vector-icons/FontAwesome5';
2021-02-25 18:47:49 +00:00
import {GoogleAnalyticsTracker} from 'react-native-google-analytics-bridge';
import {Appbar} from 'react-native-paper';
2019-06-16 13:09:54 +00:00
import IconWithBadge from './screens/IconWithBadge';
import I18n from 'react-native-i18n';
2019-06-16 13:09:54 +00:00
import Filter from './screens/home/Filter';
2021-02-25 18:47:49 +00:00
import {createMaterialBottomTabNavigator} from 'react-navigation-material-bottom-tabs';
2019-06-16 13:09:54 +00:00
import Networks from './screens/home/Networks';
2021-02-25 18:47:49 +00:00
2019-06-16 13:09:54 +00:00
const instructions = Platform.select({
2021-02-25 18:47:49 +00:00
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
android:
'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
2019-06-16 13:09:54 +00:00
});
type Props = {};
const theme = require('./utils/theme');
2021-02-25 18:47:49 +00:00
2019-06-16 13:09:54 +00:00
class HomeScreen extends Component<Props> {
2021-02-25 18:47:49 +00:00
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to iLink World!</Text>
<Text style={styles.instructions}>To get started, edit App.js</Text>
<Text style={styles.instructions}>{instructions}</Text>
</View>
);
}
2019-06-16 13:09:54 +00:00
}
2021-02-25 18:47:49 +00:00
const AuthStack = createStackNavigator({
login: Connect,
helpMenu: HelpMenu,
help: Help,
forgottenpass: ForgottenPassword,
typeaccountcreate: TypeChoiser,
simpleusercreate: createAccount,
step2: CreateUserStep2,
activateaccout: ActivateAccount,
2021-02-25 18:47:49 +00:00
}, {
headerMode: 'none',
});
2021-02-25 18:47:49 +00:00
const AppStack = createDrawerNavigator({
sta: createStackNavigator({
home: Home,
/* filtre:Filter,
network:Networks,*/
useraccount: {
screen: UserAccount,
navigationOptions: {},
2019-06-16 13:09:54 +00:00
},
2021-02-25 18:47:49 +00:00
notificationview: Notifications,
configuration: Configurations,
about: About,
2021-02-25 18:47:49 +00:00
}),
}, {contentComponent: OptionsMenu, headerMode: 'none', contentOptions: {activeTintColor: theme.accent}});
2021-02-25 18:47:49 +00:00
const AppAgentStack = createDrawerNavigator({
sta: createStackNavigator({
home: Home,
useraccount: UserAccount,
Historique:
{
screen: createBottomTabNavigator({myDemand: MyHistory}, {
headerMode: 'none',
2021-02-25 18:47:49 +00:00
header: null,
headerTitle: null,
headerTitle: I18n.t('CREDIT_MANAGE'),
tabBarOptions: {
labelStyle: {
fontSize: 13,
fontWeight: 'bold',
2021-02-25 18:47:49 +00:00
},
},
2021-02-25 18:47:49 +00:00
}),
navigationOptions: ({navigation}) => ({
header: null,
headerMode: 'none',
headerTitle: null,
activeColor: '#f0edf6',
inactiveColor: '#3e2465',
barStyle: {backgroundColor: '#694fad'},
drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({tintColor}) => (
<Icon
name={'credit-card'}
size={24}
/>),
2021-02-25 18:47:49 +00:00
}),
},
historyItemDetails: HistoryItemDetails,
creditrequest: HistoryRequester,
addNetwork: AddNetwork,
updateinformation: UpdateInformations,
notificationview: Notifications,
configuration: Configurations,
about: About,
}),
2021-02-25 18:47:49 +00:00
}, {
contentComponent: OptionsMenu,
backBehavior: 'none',
2021-02-25 18:47:49 +00:00
lazy: false,
headerMode: 'none', contentOptions: {activeTintColor: theme.accent},
});
2021-02-25 18:47:49 +00:00
const AppAdministratorStack = createDrawerNavigator({
sta: createStackNavigator({
home: Home,
useraccount: UserAccount,
Historique: {
screen: createBottomTabNavigator({
myDemand: MyHistory, OthersDemand: MyHistory,
2021-02-25 18:47:49 +00:00
}, {
headerMode: 'none',
2021-02-25 18:47:49 +00:00
header: null,
headerTitle: null,
title: I18n.t('CREDIT_MANAGE'),
tabBarOptions: {
labelStyle: {
fontSize: 13,
},
},
2021-02-25 18:47:49 +00:00
}),
navigationOptions: ({navigation}) => ({
header: null,
headerMode: 'none',
headerTitle: null,
activeColor: '#f0edf6',
inactiveColor: '#3e2465',
barStyle: {backgroundColor: '#694fad'},
drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({tintColor}) => (
<Icon
name={'credit-card'}
size={24}
/>),
2021-02-25 18:47:49 +00:00
}),
},
creditrequest: HistoryRequester,
historyItemDetails: HistoryItemDetails,
superviseurgroup: SuperViseurGroupeHome,
notificationview: Notifications,
configuration: Configurations,
about: About,
2021-02-25 18:47:49 +00:00
}),
2019-06-16 13:09:54 +00:00
},
2021-02-25 18:47:49 +00:00
{
contentComponent: OptionsMenu,
backBehavior: 'none',
headerMode: 'none',
});
2021-02-25 18:47:49 +00:00
const AppSuperAdministrator = createDrawerNavigator({
sta: createStackNavigator({
home: Home,
useraccount: UserAccount,
Historique: {
screen: createBottomTabNavigator({OthersDemand: MyHistory}, {
headerMode: 'none',
2021-02-25 18:47:49 +00:00
header: null,
headerTitle: null,
title: I18n.t('CREDIT_MANAGE'),
2019-06-16 13:09:54 +00:00
tabBarOptions: {
labelStyle: {
fontSize: 13,
fontWeight: 'bold',
2019-06-16 13:09:54 +00:00
},
},
2019-06-16 13:09:54 +00:00
}),
2021-02-25 18:47:49 +00:00
navigationOptions: ({navigation}) => ({
title: I18n.t('CREDIT_MANAGE'),
headerMode: 'none',
2021-02-25 18:47:49 +00:00
header: null,
headerTitle: null,
drawerIcon: ({tintColor}) => (
2019-06-16 13:09:54 +00:00
<Icon
name={'credit-card'}
size={24}
/>),
2019-06-16 13:09:54 +00:00
}),
},
2021-02-25 18:47:49 +00:00
creditrequest: HistoryRequester,
historyItemDetails: HistoryItemDetails,
superviseurgroup: SuperViseurGroupeHome,
notificationview: Notifications,
configuration: Configurations,
about: About,
2019-06-16 13:09:54 +00:00
}),
2021-02-25 18:47:49 +00:00
}, {
contentComponent: OptionsMenu,
backBehavior: 'none',
headerMode: 'none',
});
2021-02-25 18:47:49 +00:00
export const AppNavigator = createSwitchNavigator({
first: {
screen: SplashScreen,
2019-06-16 13:09:54 +00:00
},
2021-02-25 18:47:49 +00:00
App: AppStack,
AgentApp: AppAgentStack,
adminApp: AppAdministratorStack,
supAdminApp: AppSuperAdministrator,
Auth: AuthStack,
2021-02-25 18:47:49 +00:00
}, {
initialRouteName: 'first',
2019-06-16 13:09:54 +00:00
});
const AppContainer = createAppContainer(AppNavigator);
export default AppContainer;
const styles = StyleSheet.create({
2021-02-25 18:47:49 +00:00
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
2019-06-16 13:09:54 +00:00
});