Просмотр исходного кода

[RN] Make BaseIndicator render simpler

j8
Bettenbuk Zoltan 6 лет назад
Родитель
Сommit
b791fc32fd

+ 6
- 13
react/features/filmstrip/components/native/BaseIndicator.js Просмотреть файл

@@ -33,19 +33,12 @@ export default class BaseIndicator extends Component<Props> {
33 33
     render() {
34 34
         const { highlight, icon } = this.props;
35 35
 
36
-        const iconElement = (<Icon
37
-            name = { icon }
38
-            style = { styles.indicator } />
36
+        return (
37
+            <View style = { highlight ? styles.highlightedIndicator : null }>
38
+                <Icon
39
+                    name = { icon }
40
+                    style = { styles.indicator } />
41
+            </View>
39 42
         );
40
-
41
-        if (highlight) {
42
-            return (
43
-                <View style = { styles.indicatorBackground }>
44
-                    { iconElement }
45
-                </View>
46
-            );
47
-        }
48
-
49
-        return iconElement;
50 43
     }
51 44
 }

+ 9
- 13
react/features/filmstrip/components/native/styles.js Просмотреть файл

@@ -14,6 +14,15 @@ export const AVATAR_SIZE = 50;
14 14
  * The styles of the feature filmstrip.
15 15
  */
16 16
 export default {
17
+    /**
18
+     * Highlighted indicator additional style.
19
+     */
20
+    highlightedIndicator: {
21
+        backgroundColor: ColorPalette.blue,
22
+        borderRadius: 16,
23
+        padding: 4
24
+    },
25
+
17 26
     /**
18 27
      * Dominant speaker indicator style.
19 28
      */
@@ -28,19 +37,6 @@ export default {
28 37
         }
29 38
     },
30 39
 
31
-    /**
32
-     * Dominant speaker indicator background style.
33
-     */
34
-    indicatorBackground: {
35
-        alignItems: 'center',
36
-        backgroundColor: ColorPalette.blue,
37
-        borderRadius: 16,
38
-        flexDirection: 'row',
39
-        justifyContent: 'center',
40
-        height: 20,
41
-        width: 20
42
-    },
43
-
44 40
     /**
45 41
      * The style of the narrow {@link Filmstrip} version which displays
46 42
      * thumbnails in a row at the bottom of the screen.

Загрузка…
Отмена
Сохранить