Ver código fonte

Separate local thumbnail in filmstrip (#2848)

* Separate local thumbnail in filmstrip

* style(Filmstrip.native): utilize full line length
master
Zoltan Bettenbuk 7 anos atrás
pai
commit
4f8fd1019b

+ 12
- 9
react/features/filmstrip/components/Filmstrip.native.js Ver arquivo

@@ -10,6 +10,7 @@ import {
10 10
     makeAspectRatioAware
11 11
 } from '../../base/responsive-ui';
12 12
 
13
+import LocalThumbnail from './LocalThumbnail';
13 14
 import styles from './styles';
14 15
 import Thumbnail from './Thumbnail';
15 16
 
@@ -68,10 +69,14 @@ class Filmstrip extends Component<Props> {
68 69
             <Container
69 70
                 style = { filmstripStyle }
70 71
                 visible = { this.props._visible }>
72
+                {
73
+                    !isNarrowAspectRatio_ && <LocalThumbnail />
74
+                }
71 75
                 <ScrollView
72 76
                     horizontal = { isNarrowAspectRatio_ }
73 77
                     showsHorizontalScrollIndicator = { false }
74
-                    showsVerticalScrollIndicator = { false }>
78
+                    showsVerticalScrollIndicator = { false }
79
+                    style = { styles.scrollView } >
75 80
                     {
76 81
                         /* eslint-disable react/jsx-wrap-multilines */
77 82
 
@@ -86,6 +91,9 @@ class Filmstrip extends Component<Props> {
86 91
                         /* eslint-enable react/jsx-wrap-multilines */
87 92
                     }
88 93
                 </ScrollView>
94
+                {
95
+                    isNarrowAspectRatio_ && <LocalThumbnail />
96
+                }
89 97
             </Container>
90 98
         );
91 99
     }
@@ -106,12 +114,7 @@ class Filmstrip extends Component<Props> {
106 114
         // in place and (2) it is not necessarily stable.
107 115
 
108 116
         const sortedParticipants = [
109
-
110
-            // First put the local participant.
111
-            ...participants.filter(p => p.local),
112
-
113
-            // Then the remote participants, which are sorted by join order.
114
-            ...participants.filter(p => !p.local)
117
+            ...participants
115 118
         ];
116 119
 
117 120
         if (isNarrowAspectRatio_) {
@@ -149,12 +152,12 @@ function _mapStateToProps(state) {
149 152
         _enabled: enabled,
150 153
 
151 154
         /**
152
-         * The participants in the conference.
155
+         * The remote participants in the conference.
153 156
          *
154 157
          * @private
155 158
          * @type {Participant[]}
156 159
          */
157
-        _participants: participants,
160
+        _participants: participants.filter(p => !p.local),
158 161
 
159 162
         /**
160 163
          * The indicator which determines whether the filmstrip is visible. The

+ 63
- 0
react/features/filmstrip/components/LocalThumbnail.js Ver arquivo

@@ -0,0 +1,63 @@
1
+// @flow
2
+
3
+import React, { Component } from 'react';
4
+import { View } from 'react-native';
5
+import { connect } from 'react-redux';
6
+
7
+import { getLocalParticipant } from '../../base/participants';
8
+
9
+import styles from './styles';
10
+import Thumbnail from './Thumbnail';
11
+
12
+type Props = {
13
+
14
+    /**
15
+     * The local participant.
16
+     */
17
+    _localParticipant: Object
18
+};
19
+
20
+/**
21
+ * Component to render a local thumbnail that can be separated from the
22
+ * remote thumbnails later.
23
+ */
24
+class LocalThumbnail extends Component<Props> {
25
+    /**
26
+     * Implements React Component's render.
27
+     *
28
+     * @inheritdoc
29
+     */
30
+    render() {
31
+        const { _localParticipant } = this.props;
32
+
33
+        return (
34
+            <View style = { styles.localThumbnail }>
35
+                <Thumbnail participant = { _localParticipant } />
36
+            </View>
37
+        );
38
+    }
39
+}
40
+
41
+/**
42
+ * Maps (parts of) the redux state to the associated {@code LocalThumbnail}'s
43
+ * props.
44
+ *
45
+ * @param {Object} state - The redux state.
46
+ * @private
47
+ * @returns {{
48
+ *     _localParticipant: Participant
49
+ * }}
50
+ */
51
+function _mapStateToProps(state) {
52
+    return {
53
+        /**
54
+         * The local participant.
55
+         *
56
+         * @private
57
+         * @type {Participant}
58
+         */
59
+        _localParticipant: getLocalParticipant(state)
60
+    };
61
+}
62
+
63
+export default connect(_mapStateToProps)(LocalThumbnail);

+ 21
- 2
react/features/filmstrip/components/styles.js Ver arquivo

@@ -9,7 +9,6 @@ export const AVATAR_SIZE = 50;
9 9
  * The base style of {@link Filmstrip} shared between narrow and wide versions.
10 10
  */
11 11
 const filmstrip = {
12
-    flexDirection: 'column',
13 12
     flexGrow: 0
14 13
 };
15 14
 
@@ -43,7 +42,8 @@ export default {
43 42
      */
44 43
     filmstripNarrow: {
45 44
         ...filmstrip,
46
-        alignItems: 'flex-end',
45
+        flexDirection: 'row',
46
+        justifyContent: 'flex-end',
47 47
         height: 90
48 48
     },
49 49
 
@@ -54,11 +54,23 @@ export default {
54 54
     filmstripWide: {
55 55
         ...filmstrip,
56 56
         bottom: 0,
57
+        flexDirection: 'column',
57 58
         left: 0,
58 59
         position: 'absolute',
59 60
         top: 0
60 61
     },
61 62
 
63
+    /**
64
+     * Container of the {@link LocalThumbnail}.
65
+     */
66
+    localThumbnail: {
67
+        alignContent: 'stretch',
68
+        alignSelf: 'stretch',
69
+        aspectRatio: 1,
70
+        flexShrink: 0,
71
+        flexDirection: 'row'
72
+    },
73
+
62 74
     /**
63 75
      * Moderator indicator style.
64 76
      */
@@ -70,6 +82,13 @@ export default {
70 82
         right: 4
71 83
     },
72 84
 
85
+    /**
86
+     * The style of the scrollview containing the remote thumbnails.
87
+     */
88
+    scrollView: {
89
+        flexGrow: 0
90
+    },
91
+
73 92
     /**
74 93
      * The style of a participant's Thumbnail which renders either the video or
75 94
      * the avatar of the associated participant.

Carregando…
Cancelar
Salvar