Browse Source

[React Native] Enable scrolling of the thumbnails

master
Lyubomir Marinov 8 years ago
parent
commit
b6a6c99c9d

+ 29
- 8
react/features/filmStrip/components/FilmStrip.js View File

@@ -1,5 +1,6 @@
1 1
 import React, { Component } from 'react';
2 2
 import { connect } from 'react-redux';
3
+import { ScrollView } from 'react-native';
3 4
 
4 5
 import { Container } from '../../base/react';
5 6
 
@@ -22,14 +23,34 @@ class FilmStrip extends Component {
22 23
             <Container
23 24
                 style = { styles.filmStrip }
24 25
                 visible = { this.props.visible }>
25
-                {
26
-                    this.props.participants
27
-                        .sort((a, b) => b.local - a.local)
28
-                        .map(p =>
29
-                            <Thumbnail
30
-                                key = { p.id }
31
-                                participant = { p } />)
32
-                }
26
+                <ScrollView
27
+
28
+                    // eslint-disable-next-line react/jsx-curly-spacing
29
+                    contentContainerStyle = {
30
+                        styles.filmStripScrollViewContentContainer
31
+                    } // eslint-disable-line react/jsx-curly-spacing
32
+                    horizontal = { true }
33
+                    showsHorizontalScrollIndicator = { false }
34
+                    showsVerticalScrollIndicator = { false }>
35
+                    {
36
+                        this.props.participants
37
+
38
+                            // Group the remote participants so that the local
39
+                            // participant does not appear in between remote
40
+                            // participants.
41
+                            .sort((a, b) => b.local - a.local)
42
+
43
+                            // Have the local participant at the rightmost side.
44
+                            // Then have the remote participants from right to
45
+                            // left with the newest added/joined to the leftmost
46
+                            // side.
47
+                            .reverse()
48
+                            .map(p =>
49
+                                <Thumbnail
50
+                                    key = { p.id }
51
+                                    participant = { p } />)
52
+                    }
53
+                </ScrollView>
33 54
             </Container>
34 55
         );
35 56
     }

+ 14
- 3
react/features/filmStrip/components/styles.js View File

@@ -36,15 +36,26 @@ export const styles = {
36 36
     },
37 37
 
38 38
     /**
39
-     * Participants container style.
39
+     * The style of the Container which represents the very film strip.
40 40
      */
41 41
     filmStrip: {
42
+        alignItems: 'flex-end',
42 43
         alignSelf: 'stretch',
43 44
         bottom: 10,
44 45
         flex: 1,
45
-        flexDirection: 'row',
46
+        flexDirection: 'column',
47
+        left: 0,
46 48
         position: 'absolute',
47
-        right: 5
49
+        right: 0
50
+    },
51
+
52
+    /**
53
+     * The style of the content container of the ScrollView which is placed
54
+     * inside filmStrip and which contains the participants' thumbnails in order
55
+     * to allow scrolling through them if they do not fit within the display.
56
+     */
57
+    filmStripScrollViewContentContainer: {
58
+        paddingHorizontal: 10
48 59
     },
49 60
 
50 61
     /**

Loading…
Cancel
Save