浏览代码

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

j8
Saúl Ibarra Corretgé 5 年前
父节点
当前提交
f9888e5dbb

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

1
 // @flow
1
 // @flow
2
 
2
 
3
-import React, { Component } from 'react';
3
+import React, { PureComponent } from 'react';
4
 import { Text, View } from 'react-native';
4
 import { Text, View } from 'react-native';
5
 
5
 
6
 import { Avatar } from '../../../base/avatar';
6
 import { Avatar } from '../../../base/avatar';
68
 /**
68
 /**
69
  * Class to implement a popup menu that opens upon long pressing a thumbnail.
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
      * Constructor of the component.
73
      * Constructor of the component.
74
      *
74
      *
78
         super(props);
78
         super(props);
79
 
79
 
80
         this._onCancel = this._onCancel.bind(this);
80
         this._onCancel = this._onCancel.bind(this);
81
+        this._renderMenuHeader = this._renderMenuHeader.bind(this);
81
     }
82
     }
82
 
83
 
83
     /**
84
     /**
94
             styles: this.props._bottomSheetStyles.buttons
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
         return (
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
             </BottomSheet>
107
             </BottomSheet>
124
         );
108
         );
125
     }
109
     }
141
 
125
 
142
         return false;
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
 export default createStyleSheet({
10
 export default createStyleSheet({
11
     participantNameContainer: {
11
     participantNameContainer: {
12
         alignItems: 'center',
12
         alignItems: 'center',
13
-        borderBottomColor: ColorPalette.darkGrey,
13
+        borderBottomColor: ColorPalette.lightGrey,
14
         borderBottomWidth: 1,
14
         borderBottomWidth: 1,
15
+        borderTopLeftRadius: 16,
16
+        borderTopRightRadius: 16,
15
         flexDirection: 'row',
17
         flexDirection: 'row',
16
-        height: MD_ITEM_HEIGHT
18
+        height: MD_ITEM_HEIGHT,
19
+        paddingLeft: MD_ITEM_MARGIN_PADDING
17
     },
20
     },
18
 
21
 
19
     participantNameLabel: {
22
     participantNameLabel: {

正在加载...
取消
保存