浏览代码

Remove duplication

master
Lyubomir Marinov 8 年前
父节点
当前提交
e599491583

+ 23
- 0
react/features/base/styles/functions.js 查看文件

@@ -1,5 +1,9 @@
1 1
 /* @flow */
2 2
 
3
+import { Platform } from '../react';
4
+
5
+import { ColorPalette } from './components';
6
+
3 7
 declare type StyleSheet = Object;
4 8
 
5 9
 /**
@@ -39,6 +43,25 @@ export function createStyleSheet(styles: StyleSheet, overrides: StyleSheet = {})
39 43
     return combinedStyles;
40 44
 }
41 45
 
46
+/**
47
+ * Works around a bug in react-native or react-native-webrtc on Android which
48
+ * causes Views overlaying RTCView to be clipped. Even though we (may) display
49
+ * multiple RTCViews, it is enough to apply the fix only to a View with a
50
+ * bounding rectangle containing all RTCviews and their overlaying Views.
51
+ *
52
+ * @param {StyleSheet} styles - An object which represents a stylesheet.
53
+ * @public
54
+ * @returns {StyleSheet}
55
+ */
56
+export function fixAndroidViewClipping<T: StyleSheet>(styles: T): T {
57
+    if (Platform.OS === 'android') {
58
+        styles.borderColor = ColorPalette.appBackground;
59
+        styles.borderWidth = 0.2;
60
+    }
61
+
62
+    return styles;
63
+}
64
+
42 65
 /**
43 66
  * Shims style properties to work correctly on native. Allows us to minimize the
44 67
  * number of style declarations that need to be set or overridden for specific

+ 7
- 9
react/features/conference/components/styles.js 查看文件

@@ -1,4 +1,8 @@
1
-import { ColorPalette, createStyleSheet } from '../../base/styles';
1
+import {
2
+    ColorPalette,
3
+    createStyleSheet,
4
+    fixAndroidViewClipping
5
+} from '../../base/styles';
2 6
 
3 7
 /**
4 8
  * The style of the conference UI (component).
@@ -15,17 +19,11 @@ export const styles = createStyleSheet({
15 19
     /**
16 20
      * Conference style.
17 21
      */
18
-    conference: {
22
+    conference: fixAndroidViewClipping({
19 23
         alignSelf: 'stretch',
20 24
         backgroundColor: ColorPalette.appBackground,
21
-
22
-        // XXX These properties are a workaround for Android views clipping,
23
-        // RN doesn't properly blit our overlays on top of video views.
24
-        borderColor: ColorPalette.appBackground,
25
-        borderWidth: 0.2,
26
-
27 25
         flex: 1
28
-    },
26
+    }),
29 27
 
30 28
     /**
31 29
      * ParticipantView style

+ 8
- 9
react/features/welcome/components/styles.js 查看文件

@@ -1,4 +1,9 @@
1
-import { BoxModel, ColorPalette, createStyleSheet } from '../../base/styles';
1
+import {
2
+    BoxModel,
3
+    ColorPalette,
4
+    createStyleSheet,
5
+    fixAndroidViewClipping
6
+} from '../../base/styles';
2 7
 
3 8
 /**
4 9
  * The default color of text on the WelcomePage.
@@ -35,17 +40,11 @@ export const styles = createStyleSheet({
35 40
     /**
36 41
      * The style of the top-level container of WelcomePage.
37 42
      */
38
-    container: {
43
+    container: fixAndroidViewClipping({
39 44
         alignSelf: 'stretch',
40 45
         backgroundColor: ColorPalette.blue,
41
-
42
-        // XXX These properties are a workaround for Android views clipping,
43
-        // RN doesn't properly blit our overlays on top of video views.
44
-        borderColor: ColorPalette.appBackground,
45
-        borderWidth: 0.2,
46
-
47 46
         flex: 1
48
-    },
47
+    }),
49 48
 
50 49
     /**
51 50
      * The style of the legal-related content such as (hyper)links to Privacy

正在加载...
取消
保存