-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.android.js
More file actions
125 lines (101 loc) · 7.38 KB
/
index.android.js
File metadata and controls
125 lines (101 loc) · 7.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import React from 'react';
import {AppRegistry, Text} from 'react-native';
import { Scene, Router, Route, Reducer, Switch } from 'react-native-mobx';
import Conversation from './components/Conversation';
import Login from './components/Login';
import { Actions, ActionConst } from 'react-native-router-flux';
import Roster from './components/Roster';
import Chats from './components/Chats';
import ChatCreater from './components/ChatCreater';
import MucCreater from './components/MucCreater';
import Groups from './components/Groups';
import TabIcon from './components/TabIcon';
import InterpretationList from './components/InterpretationList';
import Settings from './components/Settings';
import Interpretation from './components/Interpretation';
import ImageViewer from './components/ImageViewer';
import xmpp from './utils/XmppStore';
import {Icon } from 'react-native-material-design';
import GroupConversation from './components/GroupConversation';
const title={color: 'white', fontSize: 20};
const navigationBar={
backgroundColor: '#1d5288',
borderColor: '#4c4c4c',
borderBottomWidth: 3,
}
const backIcon={tintColor: 'white'};
// Define all routes of the app
var DhisChat = React.createClass({
render: function() {
return (
<Router>
<Scene key="root" component={Switch} tabs selector={()=>!xmpp.logged ? 'login' : 'tabbar'} >
<Scene key="login" component={Login} title="Login" hideNavBar={true}/>
<Scene key="tabbar" tabs={true} >
<Scene key="chatTab" title="Chats" icon={TabIcon}>
<Scene key="chat" title="Chats" icon={TabIcon} component={Chats} initial={true} hideBackImage onBack={() => null}
onRight={() => Actions.newChat()} rightTitle={
<Icon
name='add-box'
color='#ffffff'
/>
} duration={0} titleStyle={title} navigationBarStyle={navigationBar}/>
<Scene key="newChat" component={ChatCreater} hideTabBar duration={0} title="Create a new chat" titleStyle={title} navigationBarStyle={navigationBar} backButtonImage={require('./image/back_chevron.png')}/>
<Scene key="conversation" component={Conversation} hideTabBar duration={0} titleStyle={title} navigationBarStyle={navigationBar} onBack={() => {Actions.chat({type:ActionConst.RESET})}} backButtonImage={require('./image/back_chevron.png')}/>
<Scene key="conView" component={ImageViewer} hideTabBar titleStyle={title} navigationBarStyle={navigationBar} duration={0} title="Zoom" backButtonImage={require('./image/back_chevron.png')}/>
</Scene>
<Scene key="contactsTab" title="Contacts" icon={TabIcon}>
<Scene key="contacts" title="Contacts" duration={0} component={Roster} hideBackImage titleStyle={title} navigationBarStyle={navigationBar}
onBack={() => null}/>
<Scene key="contactsConversation" component={Conversation} hideTabBar duration={0} onBack={() => {Actions.contacts({type:ActionConst.RESET})}} titleStyle={title} navigationBarStyle={navigationBar} backButtonImage={require('./image/back_chevron.png')}/>
</Scene>
<Scene key="groupTab" title="Groups" icon={TabIcon}>
<Scene key="group" title="Groups" component={Groups} hideBackImage duration={0} titleStyle={title} navigationBarStyle={navigationBar}
onBack={() => null}
onRight={() => {Actions.newMuc();}}
rightTitle={
<Icon
name='add-box'
color='#ffffff'
/>
}/>
<Scene key="groupConversation" component={GroupConversation} hideTabBar duration={0} onBack={() => {Actions.group({type:ActionConst.RESET})}} titleStyle={title} navigationBarStyle={navigationBar} onRight={() => {xmpp.drawerOpen = !xmpp.drawerOpen; xmpp.getOccupants(xmpp.mucRemote[1])}} rightTitle={
<Icon
name='people'
color='#ffffff'
/>
} backButtonImage={require('./image/back_chevron.png')}/>
<Scene key="mucInterpretation" component={Interpretation} hideTabBar title="Interpretation" duration={0} titleStyle={title} navigationBarStyle={navigationBar} backButtonImage={require('./image/back_chevron.png')} clone/>
<Scene key="newMuc" component={MucCreater} hideTabBar duration={0} title="New group" titleStyle={title} navigationBarStyle={navigationBar} backButtonImage={require('./image/back_chevron.png')}/>
<Scene key="mucIntView" component={ImageViewer} hideTabBar duration={0} title="Zoom" titleStyle={title} navigationBarStyle={navigationBar} backButtonImage={require('./image/back_chevron.png')}/>
</Scene>
<Scene key="interpretationTab" title="Interpretations" icon={TabIcon} >
<Scene key="interpretationList" title="Interpretations" duration={0} component={InterpretationList} hideBackImage onBack={() => null} titleStyle={title} navigationBarStyle={navigationBar} clone/>
<Scene key="interpretation" component={Interpretation} hideTabBar title="Interpretation" duration={0} titleStyle={title} navigationBarStyle={navigationBar} onRight={() => {Actions.newInterpretationMuc();
xmpp.createInterpretationMuc = true;}} rightTitle={
<Icon
name='add-box'
color={ xmpp.interpratationHasMuc ? 'transparent':'#ffffff'}
/>
} backButtonImage={require('./image/back_chevron.png')}/>
<Scene key="newInterpretationMuc" component={MucCreater} hideTabBar duration={0} navigationBarStyle={navigationBar} titleStyle={title} title="New group" onBack={() => {xmpp.createInterpretationMuc = false; Actions.pop()}} backButtonImage={require('./image/back_chevron.png')}/>
<Scene key="interConversation" component={GroupConversation} hideTabBar duration={0} onBack={() => {Actions.interpretationList({type:ActionConst.RESET})}} titleStyle={title} navigationBarStyle={navigationBar} onRight={() => {xmpp.drawerOpen = !xmpp.drawerOpen; xmpp.getOccupants(xmpp.mucRemote[1])}} rightTitle={
<Icon
name='people'
color='#ffffff'
/>
} backButtonImage={require('./image/back_chevron.png')}/>
<Scene key="intView" component={ImageViewer} hideTabBar duration={0} title="Zoom" titleStyle={title} navigationBarStyle={navigationBar} backButtonImage={require('./image/back_chevron.png')}/>
</Scene>
<Scene key="settings" title="Profile" component={Settings} icon={TabIcon} hideBackImage onBack={() => null} titleStyle={title} navigationBarStyle={navigationBar} onRight={()=>{xmpp.selfDisconnect = true; xmpp.disconnect();}} rightTitle={
<Text style={{justifyContent: 'flex-end', color: 'white'}}>
Log out
</Text>
}/>
</Scene>
</Scene>
</Router>
);
}
});
AppRegistry.registerComponent('DhisChat', () => DhisChat);