|
@@ -1,18 +1,18 @@
|
1
|
1
|
// @flow
|
2
|
2
|
|
3
|
3
|
import React from 'react';
|
4
|
|
-import { KeyboardAvoidingView, SafeAreaView } from 'react-native';
|
|
4
|
+import { KeyboardAvoidingView } from 'react-native';
|
5
|
5
|
|
6
|
|
-import { ColorSchemeRegistry } from '../../../base/color-scheme';
|
7
|
6
|
import { translate } from '../../../base/i18n';
|
8
|
|
-import { HeaderWithNavigation, SlidingView } from '../../../base/react';
|
|
7
|
+import { JitsiModal } from '../../../base/modal';
|
9
|
8
|
import { connect } from '../../../base/redux';
|
10
|
|
-import { StyleType } from '../../../base/styles';
|
|
9
|
+
|
|
10
|
+import { CHAT_VIEW_MODAL_ID } from '../../constants';
|
11
|
11
|
|
12
|
12
|
import AbstractChat, {
|
13
|
13
|
_mapDispatchToProps,
|
14
|
|
- _mapStateToProps as _abstractMapStateToProps,
|
15
|
|
- type Props as AbstractProps
|
|
14
|
+ _mapStateToProps,
|
|
15
|
+ type Props
|
16
|
16
|
} from '../AbstractChat';
|
17
|
17
|
|
18
|
18
|
import ChatInputBar from './ChatInputBar';
|
|
@@ -20,88 +20,31 @@ import MessageContainer from './MessageContainer';
|
20
|
20
|
import MessageRecipient from './MessageRecipient';
|
21
|
21
|
import styles from './styles';
|
22
|
22
|
|
23
|
|
-type Props = AbstractProps & {
|
24
|
|
-
|
25
|
|
- /**
|
26
|
|
- * The color-schemed stylesheet of the feature.
|
27
|
|
- */
|
28
|
|
- _styles: StyleType
|
29
|
|
-};
|
30
|
|
-
|
31
|
23
|
/**
|
32
|
24
|
* Implements a React native component that renders the chat window (modal) of
|
33
|
25
|
* the mobile client.
|
34
|
26
|
*/
|
35
|
27
|
class Chat extends AbstractChat<Props> {
|
36
|
|
- /**
|
37
|
|
- * Instantiates a new instance.
|
38
|
|
- *
|
39
|
|
- * @inheritdoc
|
40
|
|
- */
|
41
|
|
- constructor(props: Props) {
|
42
|
|
- super(props);
|
43
|
|
-
|
44
|
|
- this._onClose = this._onClose.bind(this);
|
45
|
|
- }
|
46
|
|
-
|
47
|
28
|
/**
|
48
|
29
|
* Implements React's {@link Component#render()}.
|
49
|
30
|
*
|
50
|
31
|
* @inheritdoc
|
51
|
32
|
*/
|
52
|
33
|
render() {
|
53
|
|
- const { _styles } = this.props;
|
54
|
|
-
|
55
|
34
|
return (
|
56
|
|
- <SlidingView
|
57
|
|
- onHide = { this._onClose }
|
58
|
|
- position = 'bottom'
|
59
|
|
- show = { this.props._isOpen } >
|
|
35
|
+ <JitsiModal
|
|
36
|
+ headerLabelKey = 'chat.title'
|
|
37
|
+ modalId = { CHAT_VIEW_MODAL_ID }>
|
60
|
38
|
<KeyboardAvoidingView
|
61
|
39
|
behavior = 'padding'
|
62
|
40
|
style = { styles.chatContainer }>
|
63
|
|
- <HeaderWithNavigation
|
64
|
|
- headerLabelKey = 'chat.title'
|
65
|
|
- onPressBack = { this._onClose } />
|
66
|
|
- <SafeAreaView style = { _styles.backdrop }>
|
67
|
|
- <MessageContainer messages = { this.props._messages } />
|
68
|
|
- <MessageRecipient />
|
69
|
|
- <ChatInputBar onSend = { this.props._onSendMessage } />
|
70
|
|
- </SafeAreaView>
|
|
41
|
+ <MessageContainer messages = { this.props._messages } />
|
|
42
|
+ <MessageRecipient />
|
|
43
|
+ <ChatInputBar onSend = { this.props._onSendMessage } />
|
71
|
44
|
</KeyboardAvoidingView>
|
72
|
|
- </SlidingView>
|
|
45
|
+ </JitsiModal>
|
73
|
46
|
);
|
74
|
47
|
}
|
75
|
|
-
|
76
|
|
- _onClose: () => boolean
|
77
|
|
-
|
78
|
|
- /**
|
79
|
|
- * Closes the chat window.
|
80
|
|
- *
|
81
|
|
- * @returns {boolean}
|
82
|
|
- */
|
83
|
|
- _onClose() {
|
84
|
|
- if (this.props._isOpen) {
|
85
|
|
- this.props._onToggleChat();
|
86
|
|
-
|
87
|
|
- return true;
|
88
|
|
- }
|
89
|
|
-
|
90
|
|
- return false;
|
91
|
|
- }
|
92
|
|
-}
|
93
|
|
-
|
94
|
|
-/**
|
95
|
|
- * Maps part of the redux state to the props of this component.
|
96
|
|
- *
|
97
|
|
- * @param {Object} state - The Redux state.
|
98
|
|
- * @returns {Props}
|
99
|
|
- */
|
100
|
|
-function _mapStateToProps(state) {
|
101
|
|
- return {
|
102
|
|
- ..._abstractMapStateToProps(state),
|
103
|
|
- _styles: ColorSchemeRegistry.get(state, 'Chat')
|
104
|
|
- };
|
105
|
48
|
}
|
106
|
49
|
|
107
|
50
|
export default translate(connect(_mapStateToProps, _mapDispatchToProps)(Chat));
|