Pārlūkot izejas kodu

ref: change JitsiModal to better fit to needs

master
Bettenbuk Zoltan 5 gadus atpakaļ
vecāks
revīzija
678ed605d7

+ 0
- 12
react/features/app/components/AbstractApp.js Parādīt failu

89
         return (
89
         return (
90
             <Fragment>
90
             <Fragment>
91
                 <OverlayContainer />
91
                 <OverlayContainer />
92
-                { this._createExtraPlatformSpecificElement() }
93
             </Fragment>
92
             </Fragment>
94
         );
93
         );
95
     }
94
     }
96
 
95
 
97
-    /**
98
-     * Renders platform specific extra elements to be added alongside with the main element, if need be.
99
-     *
100
-     * NOTE: Overridden by child components.
101
-     *
102
-     * @returns {React$Element}
103
-     */
104
-    _createExtraPlatformSpecificElement() {
105
-        return null;
106
-    }
107
-
108
     _createMainElement: (React$Element<*>, Object) => ?React$Element<*>;
96
     _createMainElement: (React$Element<*>, Object) => ?React$Element<*>;
109
 
97
 
110
     /**
98
     /**

+ 0
- 12
react/features/app/components/App.native.js Parādīt failu

12
 import '../../base/responsive-ui';
12
 import '../../base/responsive-ui';
13
 import { updateSettings } from '../../base/settings';
13
 import { updateSettings } from '../../base/settings';
14
 import '../../google-api';
14
 import '../../google-api';
15
-import { HelpView } from '../../help';
16
 import '../../mobile/audio-mode';
15
 import '../../mobile/audio-mode';
17
 import '../../mobile/back-button';
16
 import '../../mobile/back-button';
18
 import '../../mobile/background';
17
 import '../../mobile/background';
108
         });
107
         });
109
     }
108
     }
110
 
109
 
111
-    /**
112
-     * Renders platform specific extra elements to be added alongside with the main element, if need be.
113
-     *
114
-     * @inheritdoc
115
-     */
116
-    _createExtraPlatformSpecificElement() {
117
-        return (
118
-            <HelpView />
119
-        );
120
-    }
121
-
122
     /**
110
     /**
123
      * Attempts to disable the use of React Native
111
      * Attempts to disable the use of React Native
124
      * {@link ExceptionsManager#handleException} on platforms and in
112
      * {@link ExceptionsManager#handleException} on platforms and in

+ 3
- 1
react/features/base/modal/actions.js Parādīt failu

6
  * Action to set the ID of the active modal (or undefined if needs to be hidden).
6
  * Action to set the ID of the active modal (or undefined if needs to be hidden).
7
  *
7
  *
8
  * @param {string} activeModalId - The new modal ID or undefined.
8
  * @param {string} activeModalId - The new modal ID or undefined.
9
+ * @param {Object} modalProps - The props to pass to the modal.
9
  * @returns {{
10
  * @returns {{
10
  *     activeModalId: string,
11
  *     activeModalId: string,
11
  *     type: SET_ACTIVE_MODAL_ID
12
  *     type: SET_ACTIVE_MODAL_ID
12
  * }}
13
  * }}
13
  */
14
  */
14
-export function setActiveModalId(activeModalId: ?string) {
15
+export function setActiveModalId(activeModalId: ?string, modalProps: Object = {}) {
15
     return {
16
     return {
16
         activeModalId,
17
         activeModalId,
18
+        modalProps,
17
         type: SET_ACTIVE_MODAL_ID
19
         type: SET_ACTIVE_MODAL_ID
18
     };
20
     };
19
 }
21
 }

+ 28
- 12
react/features/base/modal/components/JitsiModal.js Parādīt failu

1
 // @flow
1
 // @flow
2
 
2
 
3
 import React, { PureComponent } from 'react';
3
 import React, { PureComponent } from 'react';
4
-import { SafeAreaView, View } from 'react-native';
4
+import { KeyboardAvoidingView, SafeAreaView } from 'react-native';
5
 
5
 
6
 import { ColorSchemeRegistry } from '../../color-scheme';
6
 import { ColorSchemeRegistry } from '../../color-scheme';
7
 import { HeaderWithNavigation, SlidingView } from '../../react';
7
 import { HeaderWithNavigation, SlidingView } from '../../react';
40
     dispatch: Function,
40
     dispatch: Function,
41
 
41
 
42
     /**
42
     /**
43
-     * The i18n label key of the header title.
43
+     * Optional function that renders a footer component, if needed.
44
      */
44
      */
45
-    headerLabelKey: string,
45
+    footerComponent?: Function,
46
+
47
+    /**
48
+     * Props to be passed over to the header.
49
+     *
50
+     * See {@code HeaderWithNavigation} for more details.
51
+     */
52
+    headerProps: Object,
46
 
53
 
47
     /**
54
     /**
48
      * The ID of the modal that is being rendered. This is used to show/hide the modal.
55
      * The ID of the modal that is being rendered. This is used to show/hide the modal.
58
      * The position from where the modal should be opened. This is derived from the
65
      * The position from where the modal should be opened. This is derived from the
59
      * props of the {@code SlidingView} with the same name.
66
      * props of the {@code SlidingView} with the same name.
60
      */
67
      */
61
-    position?: string
68
+    position?: string,
69
+
70
+    /**
71
+     * Additional style to be appended to the View containing the content of the modal.
72
+     */
73
+    style?: StyleType
62
 };
74
 };
63
 
75
 
64
 /**
76
 /**
87
      * @inheritdoc
99
      * @inheritdoc
88
      */
100
      */
89
     render() {
101
     render() {
90
-        const { _headerStyles, _show, _styles, children, headerLabelKey, position } = this.props;
102
+        const { _headerStyles, _show, _styles, children, footerComponent, headerProps, position, style } = this.props;
91
 
103
 
92
         return (
104
         return (
93
             <SlidingView
105
             <SlidingView
94
                 onHide = { this._onRequestClose }
106
                 onHide = { this._onRequestClose }
95
                 position = { position }
107
                 position = { position }
96
                 show = { _show }>
108
                 show = { _show }>
97
-                <View
109
+                <KeyboardAvoidingView
110
+                    behavior = 'padding'
98
                     style = { [
111
                     style = { [
99
                         _headerStyles.page,
112
                         _headerStyles.page,
100
-                        _styles.page
113
+                        _styles.page,
114
+                        style
101
                     ] }>
115
                     ] }>
102
                     <HeaderWithNavigation
116
                     <HeaderWithNavigation
103
-                        headerLabelKey = { headerLabelKey }
117
+                        { ...headerProps }
104
                         onPressBack = { this._onRequestClose } />
118
                         onPressBack = { this._onRequestClose } />
105
                     <SafeAreaView style = { styles.safeArea }>
119
                     <SafeAreaView style = { styles.safeArea }>
106
                         { children }
120
                         { children }
107
                     </SafeAreaView>
121
                     </SafeAreaView>
108
-                </View>
122
+                    { footerComponent && footerComponent() }
123
+                </KeyboardAvoidingView>
109
             </SlidingView>
124
             </SlidingView>
110
         );
125
         );
111
     }
126
     }
119
      */
134
      */
120
     _onRequestClose() {
135
     _onRequestClose() {
121
         const { _show, dispatch, onClose } = this.props;
136
         const { _show, dispatch, onClose } = this.props;
137
+        let shouldCloseModal = true;
122
 
138
 
123
         if (_show) {
139
         if (_show) {
124
             if (typeof onClose === 'function') {
140
             if (typeof onClose === 'function') {
125
-                onClose();
141
+                shouldCloseModal = onClose();
126
             }
142
             }
127
-            dispatch(setActiveModalId());
143
+            shouldCloseModal && dispatch(setActiveModalId());
128
 
144
 
129
-            return true;
145
+            return shouldCloseModal;
130
         }
146
         }
131
 
147
 
132
         return false;
148
         return false;

+ 1
- 0
react/features/base/modal/components/styles.js Parādīt failu

10
 
10
 
11
 ColorSchemeRegistry.register('Modal', {
11
 ColorSchemeRegistry.register('Modal', {
12
     page: {
12
     page: {
13
+        alignItems: 'stretch',
13
         backgroundColor: schemeColor('background')
14
         backgroundColor: schemeColor('background')
14
     }
15
     }
15
 });
16
 });

+ 2
- 1
react/features/base/modal/reducer.js Parādīt failu

9
     case SET_ACTIVE_MODAL_ID:
9
     case SET_ACTIVE_MODAL_ID:
10
         return {
10
         return {
11
             ...state,
11
             ...state,
12
-            activeModalId: action.activeModalId
12
+            activeModalId: action.activeModalId,
13
+            modalProps: action.modalProps
13
         };
14
         };
14
     }
15
     }
15
 
16
 

+ 6
- 10
react/features/chat/components/native/Chat.js Parādīt failu

1
 // @flow
1
 // @flow
2
 
2
 
3
 import React from 'react';
3
 import React from 'react';
4
-import { KeyboardAvoidingView } from 'react-native';
5
 
4
 
6
 import { translate } from '../../../base/i18n';
5
 import { translate } from '../../../base/i18n';
7
 import { JitsiModal } from '../../../base/modal';
6
 import { JitsiModal } from '../../../base/modal';
18
 import ChatInputBar from './ChatInputBar';
17
 import ChatInputBar from './ChatInputBar';
19
 import MessageContainer from './MessageContainer';
18
 import MessageContainer from './MessageContainer';
20
 import MessageRecipient from './MessageRecipient';
19
 import MessageRecipient from './MessageRecipient';
21
-import styles from './styles';
22
 
20
 
23
 /**
21
 /**
24
  * Implements a React native component that renders the chat window (modal) of
22
  * Implements a React native component that renders the chat window (modal) of
33
     render() {
31
     render() {
34
         return (
32
         return (
35
             <JitsiModal
33
             <JitsiModal
36
-                headerLabelKey = 'chat.title'
34
+                headerProps = {{
35
+                    headerLabelKey: 'chat.title'
36
+                }}
37
                 modalId = { CHAT_VIEW_MODAL_ID }>
37
                 modalId = { CHAT_VIEW_MODAL_ID }>
38
-                <KeyboardAvoidingView
39
-                    behavior = 'padding'
40
-                    style = { styles.chatContainer }>
41
-                    <MessageContainer messages = { this.props._messages } />
42
-                    <MessageRecipient />
43
-                    <ChatInputBar onSend = { this.props._onSendMessage } />
44
-                </KeyboardAvoidingView>
38
+                <MessageContainer messages = { this.props._messages } />
39
+                <MessageRecipient />
40
+                <ChatInputBar onSend = { this.props._onSendMessage } />
45
             </JitsiModal>
41
             </JitsiModal>
46
         );
42
         );
47
     }
43
     }

+ 0
- 6
react/features/chat/components/native/styles.js Parādīt failu

23
         width: 32
23
         width: 32
24
     },
24
     },
25
 
25
 
26
-    chatContainer: {
27
-        alignItems: 'stretch',
28
-        flex: 1,
29
-        flexDirection: 'column'
30
-    },
31
-
32
     chatLink: {
26
     chatLink: {
33
         color: ColorPalette.blue
27
         color: ColorPalette.blue
34
     },
28
     },

+ 15
- 4
react/features/conference/components/native/Conference.js Parādīt failu

213
         return true;
213
         return true;
214
     }
214
     }
215
 
215
 
216
+    /**
217
+     * Renders JitsiModals that are supposed to be on the conference screen.
218
+     *
219
+     * @returns {Array<ReactElement>}
220
+     */
221
+    _renderConferenceModals() {
222
+        return [
223
+            <AddPeopleDialog key = 'addPeopleDialog' />,
224
+            <Chat key = 'chat' />,
225
+            <SharedDocument key = 'sharedDocument' />
226
+        ];
227
+    }
228
+
216
     /**
229
     /**
217
      * Renders the conference notification badge if the feature is enabled.
230
      * Renders the conference notification badge if the feature is enabled.
218
      *
231
      *
252
 
265
 
253
         return (
266
         return (
254
             <>
267
             <>
255
-                <AddPeopleDialog />
256
-                <Chat />
257
-                <SharedDocument />
258
-
259
                 {/*
268
                 {/*
260
                   * The LargeVideo is the lowermost stacking layer.
269
                   * The LargeVideo is the lowermost stacking layer.
261
                   */
270
                   */
335
                 <TestConnectionInfo />
344
                 <TestConnectionInfo />
336
 
345
 
337
                 { this._renderConferenceNotification() }
346
                 { this._renderConferenceNotification() }
347
+
348
+                { this._renderConferenceModals() }
338
             </>
349
             </>
339
         );
350
         );
340
     }
351
     }

+ 4
- 0
react/features/conference/middleware.js Parādīt failu

10
     setPreferredReceiverVideoQuality
10
     setPreferredReceiverVideoQuality
11
 } from '../base/conference';
11
 } from '../base/conference';
12
 import { hideDialog, isDialogOpen } from '../base/dialog';
12
 import { hideDialog, isDialogOpen } from '../base/dialog';
13
+import { setActiveModalId } from '../base/modal';
13
 import { pinParticipant } from '../base/participants';
14
 import { pinParticipant } from '../base/participants';
14
 import { SET_REDUCED_UI } from '../base/responsive-ui';
15
 import { SET_REDUCED_UI } from '../base/responsive-ui';
15
 import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
16
 import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
84
                 // dialog we might have open.
85
                 // dialog we might have open.
85
                 dispatch(hideDialog());
86
                 dispatch(hideDialog());
86
             }
87
             }
88
+
89
+            // We want to close all modals.
90
+            dispatch(setActiveModalId());
87
         }
91
         }
88
     });
92
     });

+ 3
- 1
react/features/help/components/HelpView.js Parādīt failu

31
     render() {
31
     render() {
32
         return (
32
         return (
33
             <JitsiModal
33
             <JitsiModal
34
-                headerLabelKey = 'helpView.header'
34
+                headerProps = {{
35
+                    headerLabelKey: 'helpView.header'
36
+                }}
35
                 modalId = { HELP_VIEW_MODAL_ID }>
37
                 modalId = { HELP_VIEW_MODAL_ID }>
36
                 <WebView source = {{ uri: this.props._url }} />
38
                 <WebView source = {{ uri: this.props._url }} />
37
             </JitsiModal>
39
             </JitsiModal>

+ 15
- 2
react/features/welcome/components/WelcomePage.native.js Parādīt failu

22
     createDesiredLocalTracks,
22
     createDesiredLocalTracks,
23
     destroyLocalTracks
23
     destroyLocalTracks
24
 } from '../../base/tracks';
24
 } from '../../base/tracks';
25
+import { HelpView } from '../../help';
25
 import { DialInSummary } from '../../invite';
26
 import { DialInSummary } from '../../invite';
26
 import { SettingsView } from '../../settings';
27
 import { SettingsView } from '../../settings';
27
 
28
 
288
                         </View>
289
                         </View>
289
                     </SafeAreaView>
290
                     </SafeAreaView>
290
                     <WelcomePageLists disabled = { this.state._fieldFocused } />
291
                     <WelcomePageLists disabled = { this.state._fieldFocused } />
291
-                    <SettingsView />
292
-                    <DialInSummary />
293
                 </View>
292
                 </View>
294
                 <WelcomePageSideBar />
293
                 <WelcomePageSideBar />
294
+                { this._renderWelcomePageModals() }
295
             </LocalVideoTrackUnderlay>
295
             </LocalVideoTrackUnderlay>
296
         );
296
         );
297
     }
297
     }
312
             </View>
312
             </View>
313
         );
313
         );
314
     }
314
     }
315
+
316
+    /**
317
+     * Renders JitsiModals that are supposed to be on the welcome page.
318
+     *
319
+     * @returns {Array<ReactElement>}
320
+     */
321
+    _renderWelcomePageModals() {
322
+        return [
323
+            <HelpView key = 'helpView' />,
324
+            <DialInSummary key = 'dialInSummary' />,
325
+            <SettingsView key = 'settings' />
326
+        ];
327
+    }
315
 }
328
 }
316
 
329
 
317
 /**
330
 /**

Notiek ielāde…
Atcelt
Saglabāt