Browse Source

Separate local thumbnail in filmstrip (#2848)

* Separate local thumbnail in filmstrip

* style(Filmstrip.native): utilize full line length
master
Zoltan Bettenbuk 7 years ago
parent
commit
4f8fd1019b

+ 12
- 9
react/features/filmstrip/components/Filmstrip.native.js View File

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

+ 63
- 0
react/features/filmstrip/components/LocalThumbnail.js View File

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 View File

9
  * The base style of {@link Filmstrip} shared between narrow and wide versions.
9
  * The base style of {@link Filmstrip} shared between narrow and wide versions.
10
  */
10
  */
11
 const filmstrip = {
11
 const filmstrip = {
12
-    flexDirection: 'column',
13
     flexGrow: 0
12
     flexGrow: 0
14
 };
13
 };
15
 
14
 
43
      */
42
      */
44
     filmstripNarrow: {
43
     filmstripNarrow: {
45
         ...filmstrip,
44
         ...filmstrip,
46
-        alignItems: 'flex-end',
45
+        flexDirection: 'row',
46
+        justifyContent: 'flex-end',
47
         height: 90
47
         height: 90
48
     },
48
     },
49
 
49
 
54
     filmstripWide: {
54
     filmstripWide: {
55
         ...filmstrip,
55
         ...filmstrip,
56
         bottom: 0,
56
         bottom: 0,
57
+        flexDirection: 'column',
57
         left: 0,
58
         left: 0,
58
         position: 'absolute',
59
         position: 'absolute',
59
         top: 0
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
      * Moderator indicator style.
75
      * Moderator indicator style.
64
      */
76
      */
70
         right: 4
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
      * The style of a participant's Thumbnail which renders either the video or
93
      * The style of a participant's Thumbnail which renders either the video or
75
      * the avatar of the associated participant.
94
      * the avatar of the associated participant.

Loading…
Cancel
Save