瀏覽代碼

feat(toolbox): Fixed background color prop custom buttons (#15529)

* feat(toolbox): fixed backgroundColor prop for custom menu buttons
factor2
Calinteodor 8 月之前
父節點
當前提交
75c43fc8f2
沒有連結到貢獻者的電子郵件帳戶。

+ 24
- 12
react/features/toolbox/components/native/CustomOptionButton.tsx 查看文件

1
 import React from 'react';
1
 import React from 'react';
2
-import { Image } from 'react-native';
2
+import { Image, View, ViewStyle } from 'react-native';
3
 import { SvgCssUri } from 'react-native-svg';
3
 import { SvgCssUri } from 'react-native-svg';
4
 import { connect } from 'react-redux';
4
 import { connect } from 'react-redux';
5
 
5
 
6
 import { translate } from '../../../base/i18n/functions';
6
 import { translate } from '../../../base/i18n/functions';
7
 import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
7
 import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
8
+import BaseTheme from '../../../base/ui/components/BaseTheme.native';
8
 
9
 
9
 import styles from './styles';
10
 import styles from './styles';
10
 
11
 
13
     backgroundColor?: string;
14
     backgroundColor?: string;
14
     icon: any;
15
     icon: any;
15
     id?: string;
16
     id?: string;
17
+    isToolboxButton?: boolean;
16
     text?: string;
18
     text?: string;
17
 }
19
 }
18
 
20
 
40
         }
42
         }
41
 
43
 
42
         if (this.iconSrc?.includes('svg')) {
44
         if (this.iconSrc?.includes('svg')) {
43
-            iconComponent
44
-                = (
45
-                    <SvgCssUri
46
-                        style = { styles.iconImageStyles }
47
-                        uri = { this.iconSrc } />);
45
+            iconComponent = (
46
+                <SvgCssUri
47
+                    height = { BaseTheme.spacing[4] }
48
+                    uri = { this.iconSrc }
49
+                    width = { BaseTheme.spacing[4] } />
50
+            );
48
         } else {
51
         } else {
49
-            iconComponent
50
-                = (
51
-                    <Image
52
-                        source = {{ uri: this.iconSrc }}
53
-                        style = { styles.iconImageStyles } />);
52
+            iconComponent = (
53
+                <Image
54
+                    height = { BaseTheme.spacing[4] }
55
+                    resizeMode = { 'contain' }
56
+                    source = {{ uri: this.iconSrc }}
57
+                    width = { BaseTheme.spacing[4] } />
58
+            );
54
         }
59
         }
55
 
60
 
56
-        return iconComponent;
61
+        return (
62
+            <View
63
+                style = { this.props.isToolboxButton && [
64
+                    styles.toolboxButtonIconContainer,
65
+                    { backgroundColor: this.backgroundColor } ] as ViewStyle }>
66
+                { iconComponent }
67
+            </View>
68
+        );
57
     };
69
     };
58
 
70
 
59
     label = this.text || '';
71
     label = this.text || '';

+ 1
- 0
react/features/toolbox/components/native/OverflowMenu.tsx 查看文件

237
                                 dispatch(customButtonPressed(id, text))
237
                                 dispatch(customButtonPressed(id, text))
238
                             }
238
                             }
239
                             icon = { icon }
239
                             icon = { icon }
240
+                            isToolboxButton = { false }
240
                             key = { id }
241
                             key = { id }
241
                             text = { text } />
242
                             text = { text } />
242
                     ))
243
                     ))

+ 7
- 1
react/features/toolbox/components/native/Toolbox.tsx 查看文件

126
                             /* eslint-disable react/jsx-no-bind */
126
                             /* eslint-disable react/jsx-no-bind */
127
                             handleClick = { () => dispatch(customButtonPressed(id, text)) }
127
                             handleClick = { () => dispatch(customButtonPressed(id, text)) }
128
                             icon = { icon }
128
                             icon = { icon }
129
+                            isToolboxButton = { true }
129
                             key = { id } />
130
                             key = { id } />
130
                     ))
131
                     ))
131
                 }
132
                 }
145
                 style = { style as ViewStyle }>
146
                 style = { style as ViewStyle }>
146
                 {
147
                 {
147
                     _customToolbarButtons
148
                     _customToolbarButtons
148
-                        ? renderCustomToolboxButtons()
149
+                        ? <>
150
+                            { renderCustomToolboxButtons() }
151
+                            { !_iAmVisitor && <OverflowMenuButton
152
+                                styles = { buttonStylesBorderless }
153
+                                toggledStyles = { toggledButtonStyles } /> }
154
+                        </>
149
                         : <>
155
                         : <>
150
                             {!_iAmVisitor && <AudioMuteButton
156
                             {!_iAmVisitor && <AudioMuteButton
151
                                 styles = { buttonStylesBorderless }
157
                                 styles = { buttonStylesBorderless }

+ 7
- 4
react/features/toolbox/components/native/styles.ts 查看文件

101
         maxWidth: 580,
101
         maxWidth: 580,
102
         marginHorizontal: 'auto',
102
         marginHorizontal: 'auto',
103
         marginVertical: BaseTheme.spacing[0],
103
         marginVertical: BaseTheme.spacing[0],
104
-        paddingHorizontal: BaseTheme.spacing[1],
104
+        paddingHorizontal: BaseTheme.spacing[2],
105
         width: '100%'
105
         width: '100%'
106
     },
106
     },
107
 
107
 
108
-    iconImageStyles: {
109
-        height: BaseTheme.spacing[4],
110
-        width: BaseTheme.spacing[4]
108
+    toolboxButtonIconContainer: {
109
+        alignItems: 'center',
110
+        borderRadius: BaseTheme.shape.borderRadius,
111
+        height: BaseTheme.spacing[7],
112
+        justifyContent: 'center',
113
+        width: BaseTheme.spacing[7]
111
     }
114
     }
112
 };
115
 };
113
 
116
 

Loading…
取消
儲存