ilink-world/App.js

333 lines
12 KiB
JavaScript
Raw Normal View History

2019-06-16 13:09:54 +00:00
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
2020-03-20 18:28:22 +00:00
import React, { Component } from 'react';
import { Platform, StyleSheet, Text, View, YellowBox } from 'react-native';
2020-04-17 22:03:04 +00:00
import { createSwitchNavigator, createStackNavigator, createDrawerNavigator, createAppContainer, createBottomTabNavigator, HeaderBackButton } from 'react-navigation';
2019-06-16 13:09:54 +00:00
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";
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";
import { Appbar } from 'react-native-paper';
import IconWithBadge from "./screens/IconWithBadge"
import I18n from "react-native-i18n";
import Filter from './screens/home/Filter';
import { createMaterialBottomTabNavigator } from 'react-navigation-material-bottom-tabs';
2020-04-17 22:03:04 +00:00
import WalletDetail from './screens/wallet/WalletDetail';
import WalletSelect from './screens/wallet/WalletSelect';
import { PersistGate } from 'redux-persist/integration/react';
import { store, persistor } from './redux/store';
2019-06-16 13:09:54 +00:00
const instructions = Platform.select({
2020-03-20 18:28:22 +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
});
2020-03-20 18:28:22 +00:00
const theme = require("./utils/theme")
2020-04-17 22:03:04 +00:00
const WalletSelectStack = createStackNavigator({
walletSelect: WalletSelect
});
2020-03-20 18:28:22 +00:00
const AuthStack = createStackNavigator({
login: Connect,
helpMenu: HelpMenu,
help: Help,
forgottenpass: ForgottenPassword,
typeaccountcreate: TypeChoiser,
simpleusercreate: createAccount,
step2: CreateUserStep2,
activateaccout: ActivateAccount
}, {
headerMode: 'none'
})
const AppStack = createDrawerNavigator({
sta: createStackNavigator({
home: Home,
/* filtre:Filter,
network:Networks,*/
useraccount: {
screen: UserAccount,
navigationOptions: {
},
},
notificationview: Notifications,
configuration: Configurations,
about: About
})
}, { contentComponent: OptionsMenu, headerMode: 'none', contentOptions: { activeTintColor: theme.accent } })
2020-04-11 22:33:59 +00:00
2020-03-20 18:28:22 +00:00
const AppAgentStack = createDrawerNavigator({
sta: createStackNavigator({
home: Home,
useraccount: UserAccount,
2020-04-17 22:03:04 +00:00
walletSelect: {
screen: WalletSelectStack,
navigationOptions: ({ navigation }) => ({
header: null,
headerMode: 'none',
headerTitle: null,
activeColor: '#f0edf6',
inactiveColor: '#3e2465',
barStyle: { backgroundColor: '#694fad' },
headerLeft: (<HeaderBackButton />),
drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({ tintColor }) => (
<Icon
name={'credit-card'}
size={24}
/>)
}),
},
2020-03-20 18:28:22 +00:00
Historique:
{
screen: createBottomTabNavigator({ myDemand: MyHistory }, {
headerMode: "none",
header: null,
headerTitle: null,
headerTitle: I18n.t('CREDIT_MANAGE'),
tabBarOptions: {
labelStyle: {
fontSize: 13,
fontWeight: "bold"
},
}
}),
navigationOptions: ({ navigation }) => ({
header: null,
headerMode: 'none',
headerTitle: null,
activeColor: '#f0edf6',
inactiveColor: '#3e2465',
barStyle: { backgroundColor: '#694fad' },
2020-04-17 22:03:04 +00:00
headerLeft: (<HeaderBackButton />),
2020-03-20 18:28:22 +00:00
drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({ tintColor }) => (
<Icon
name={'credit-card'}
size={24}
/>)
}),
},
historyItemDetails: HistoryItemDetails,
creditrequest: HistoryRequester,
addNetwork: AddNetwork,
updateinformation: UpdateInformations,
notificationview: Notifications,
configuration: Configurations,
2020-04-17 22:03:04 +00:00
about: About,
walletDetail: WalletDetail
2020-03-20 18:28:22 +00:00
})
}, {
contentComponent: OptionsMenu,
backBehavior: "none",
lazy: false,
headerMode: 'none', contentOptions: { activeTintColor: theme.accent }
})
const AppAdministratorStack = createDrawerNavigator({
sta: createStackNavigator({
home: Home,
useraccount: UserAccount,
2020-04-17 22:03:04 +00:00
walletSelect: {
screen: WalletSelectStack,
navigationOptions: ({ navigation }) => ({
header: null,
headerMode: 'none',
headerTitle: null,
activeColor: '#f0edf6',
inactiveColor: '#3e2465',
barStyle: { backgroundColor: '#694fad' },
headerLeft: (<HeaderBackButton />),
drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({ tintColor }) => (
<Icon
name={'credit-card'}
size={24}
/>)
}),
},
2020-03-20 18:28:22 +00:00
Historique: {
screen: createBottomTabNavigator({
myDemand: MyHistory, OthersDemand: MyHistory
}, {
headerMode: "none",
header: null,
headerTitle: null,
title: I18n.t('CREDIT_MANAGE'),
tabBarOptions: {
labelStyle: {
fontSize: 13,
},
}
}),
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}
/>)
}),
},
creditrequest: HistoryRequester,
historyItemDetails: HistoryItemDetails,
superviseurgroup: SuperViseurGroupeHome,
notificationview: Notifications,
configuration: Configurations,
2020-04-17 22:03:04 +00:00
about: About,
walletDetail: WalletDetail
2020-03-20 18:28:22 +00:00
})
},
{
contentComponent: OptionsMenu,
backBehavior: "none",
headerMode: 'none'
})
const AppSuperAdministrator = createDrawerNavigator({
sta: createStackNavigator({
home: Home,
useraccount: UserAccount,
2020-04-17 22:03:04 +00:00
walletSelect: {
screen: WalletSelectStack,
navigationOptions: ({ navigation }) => ({
header: null,
headerMode: 'none',
headerTitle: null,
activeColor: '#f0edf6',
inactiveColor: '#3e2465',
barStyle: { backgroundColor: '#694fad' },
headerLeft: (<HeaderBackButton />),
drawerLabel: I18n.t('CREDIT_MANAGE'),
drawerIcon: ({ tintColor }) => (
<Icon
name={'credit-card'}
size={24}
/>)
}),
},
2020-03-20 18:28:22 +00:00
Historique: {
screen: createBottomTabNavigator({ OthersDemand: MyHistory }, {
headerMode: "none",
header: null,
headerTitle: null,
title: I18n.t('CREDIT_MANAGE'),
tabBarOptions: {
labelStyle: {
fontSize: 13,
fontWeight: "bold"
},
}
}),
navigationOptions: ({ navigation }) => ({
title: I18n.t('CREDIT_MANAGE'),
headerMode: "none",
header: null,
headerTitle: null,
drawerIcon: ({ tintColor }) => (
<Icon
name={'credit-card'}
size={24}
/>)
}),
},
creditrequest: HistoryRequester,
historyItemDetails: HistoryItemDetails,
superviseurgroup: SuperViseurGroupeHome,
notificationview: Notifications,
configuration: Configurations,
2020-04-17 22:03:04 +00:00
about: About,
walletDetail: WalletDetail
2020-03-20 18:28:22 +00:00
})
}, {
contentComponent: OptionsMenu,
backBehavior: "none",
headerMode: 'none'
2019-06-16 13:09:54 +00:00
})
2020-03-20 18:28:22 +00:00
export const AppNavigator = createSwitchNavigator({
first: {
screen: SplashScreen
},
App: AppStack,
AgentApp: AppAgentStack,
adminApp: AppAdministratorStack,
supAdminApp: AppSuperAdministrator,
Auth: AuthStack
}, {
initialRouteName: 'first'
2019-06-16 13:09:54 +00:00
});
const AppContainer = createAppContainer(AppNavigator);
2020-04-17 22:03:04 +00:00
class App extends React.Component {
render() {
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<AppContainer />
</PersistGate>
</Provider>
);
}
}
export default App;
2019-06-16 13:09:54 +00:00
const styles = StyleSheet.create({
2020-03-20 18:28:22 +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
});