瀏覽代碼

rn,remote-video-menu: make UI consistent with other menus

master
Saúl Ibarra Corretgé 5 年之前
父節點
當前提交
f9888e5dbb

+ 36
- 27
react/features/remote-video-menu/components/native/RemoteVideoMenu.js 查看文件

@@ -1,6 +1,6 @@
1 1
 // @flow
2 2
 
3
-import React, { Component } from 'react';
3
+import React, { PureComponent } from 'react';
4 4
 import { Text, View } from 'react-native';
5 5
 
6 6
 import { Avatar } from '../../../base/avatar';
@@ -68,7 +68,7 @@ let RemoteVideoMenu_;
68 68
 /**
69 69
  * Class to implement a popup menu that opens upon long pressing a thumbnail.
70 70
  */
71
-class RemoteVideoMenu extends Component<Props> {
71
+class RemoteVideoMenu extends PureComponent<Props> {
72 72
     /**
73 73
      * Constructor of the component.
74 74
      *
@@ -78,6 +78,7 @@ class RemoteVideoMenu extends Component<Props> {
78 78
         super(props);
79 79
 
80 80
         this._onCancel = this._onCancel.bind(this);
81
+        this._renderMenuHeader = this._renderMenuHeader.bind(this);
81 82
     }
82 83
 
83 84
     /**
@@ -94,32 +95,15 @@ class RemoteVideoMenu extends Component<Props> {
94 95
             styles: this.props._bottomSheetStyles.buttons
95 96
         };
96 97
 
97
-        const buttons = [];
98
-
99
-        if (!_disableRemoteMute) {
100
-            buttons.push(<MuteButton { ...buttonProps } />);
101
-        }
102
-
103
-        buttons.push(<GrantModeratorButton { ...buttonProps } />);
104
-
105
-        if (!_disableKick) {
106
-            buttons.push(<KickButton { ...buttonProps } />);
107
-        }
108
-
109
-        buttons.push(<PinButton { ...buttonProps } />);
110
-        buttons.push(<PrivateMessageButton { ...buttonProps } />);
111
-
112 98
         return (
113
-            <BottomSheet onCancel = { this._onCancel }>
114
-                <View style = { styles.participantNameContainer }>
115
-                    <Avatar
116
-                        participantId = { participant.id }
117
-                        size = { AVATAR_SIZE } />
118
-                    <Text style = { styles.participantNameLabel }>
119
-                        { this.props._participantDisplayName }
120
-                    </Text>
121
-                </View>
122
-                { buttons }
99
+            <BottomSheet
100
+                onCancel = { this._onCancel }
101
+                renderHeader = { this._renderMenuHeader }>
102
+                { !_disableRemoteMute && <MuteButton { ...buttonProps } /> }
103
+                { !_disableKick && <KickButton { ...buttonProps } /> }
104
+                <GrantModeratorButton { ...buttonProps } />
105
+                <PinButton { ...buttonProps } />
106
+                <PrivateMessageButton { ...buttonProps } />
123 107
             </BottomSheet>
124 108
         );
125 109
     }
@@ -141,6 +125,31 @@ class RemoteVideoMenu extends Component<Props> {
141 125
 
142 126
         return false;
143 127
     }
128
+
129
+    _renderMenuHeader: () => React$Element<any>;
130
+
131
+    /**
132
+     * Function to render the menu's header.
133
+     *
134
+     * @returns {React$Element}
135
+     */
136
+    _renderMenuHeader() {
137
+        const { _bottomSheetStyles, participant } = this.props;
138
+
139
+        return (
140
+            <View
141
+                style = { [
142
+                    _bottomSheetStyles.sheet,
143
+                    styles.participantNameContainer ] }>
144
+                <Avatar
145
+                    participantId = { participant.id }
146
+                    size = { AVATAR_SIZE } />
147
+                <Text style = { styles.participantNameLabel }>
148
+                    { this.props._participantDisplayName }
149
+                </Text>
150
+            </View>
151
+        );
152
+    }
144 153
 }
145 154
 
146 155
 /**

+ 5
- 2
react/features/remote-video-menu/components/native/styles.js 查看文件

@@ -10,10 +10,13 @@ import { ColorPalette, createStyleSheet } from '../../../base/styles';
10 10
 export default createStyleSheet({
11 11
     participantNameContainer: {
12 12
         alignItems: 'center',
13
-        borderBottomColor: ColorPalette.darkGrey,
13
+        borderBottomColor: ColorPalette.lightGrey,
14 14
         borderBottomWidth: 1,
15
+        borderTopLeftRadius: 16,
16
+        borderTopRightRadius: 16,
15 17
         flexDirection: 'row',
16
-        height: MD_ITEM_HEIGHT
18
+        height: MD_ITEM_HEIGHT,
19
+        paddingLeft: MD_ITEM_MARGIN_PADDING
17 20
     },
18 21
 
19 22
     participantNameLabel: {

Loading…
取消
儲存