浏览代码

[React Native] Enable scrolling of the thumbnails

master
Lyubomir Marinov 8 年前
父节点
当前提交
b6a6c99c9d
共有 2 个文件被更改,包括 43 次插入11 次删除
  1. 29
    8
      react/features/filmStrip/components/FilmStrip.js
  2. 14
    3
      react/features/filmStrip/components/styles.js

+ 29
- 8
react/features/filmStrip/components/FilmStrip.js 查看文件

1
 import React, { Component } from 'react';
1
 import React, { Component } from 'react';
2
 import { connect } from 'react-redux';
2
 import { connect } from 'react-redux';
3
+import { ScrollView } from 'react-native';
3
 
4
 
4
 import { Container } from '../../base/react';
5
 import { Container } from '../../base/react';
5
 
6
 
22
             <Container
23
             <Container
23
                 style = { styles.filmStrip }
24
                 style = { styles.filmStrip }
24
                 visible = { this.props.visible }>
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
             </Container>
54
             </Container>
34
         );
55
         );
35
     }
56
     }

+ 14
- 3
react/features/filmStrip/components/styles.js 查看文件

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
     filmStrip: {
41
     filmStrip: {
42
+        alignItems: 'flex-end',
42
         alignSelf: 'stretch',
43
         alignSelf: 'stretch',
43
         bottom: 10,
44
         bottom: 10,
44
         flex: 1,
45
         flex: 1,
45
-        flexDirection: 'row',
46
+        flexDirection: 'column',
47
+        left: 0,
46
         position: 'absolute',
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
     /**

正在加载...
取消
保存