Browse Source

Remove duplication

master
Lyubomir Marinov 8 years ago
parent
commit
e599491583

+ 23
- 0
react/features/base/styles/functions.js View File

1
 /* @flow */
1
 /* @flow */
2
 
2
 
3
+import { Platform } from '../react';
4
+
5
+import { ColorPalette } from './components';
6
+
3
 declare type StyleSheet = Object;
7
 declare type StyleSheet = Object;
4
 
8
 
5
 /**
9
 /**
39
     return combinedStyles;
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
  * Shims style properties to work correctly on native. Allows us to minimize the
66
  * Shims style properties to work correctly on native. Allows us to minimize the
44
  * number of style declarations that need to be set or overridden for specific
67
  * number of style declarations that need to be set or overridden for specific

+ 7
- 9
react/features/conference/components/styles.js View File

1
-import { ColorPalette, createStyleSheet } from '../../base/styles';
1
+import {
2
+    ColorPalette,
3
+    createStyleSheet,
4
+    fixAndroidViewClipping
5
+} from '../../base/styles';
2
 
6
 
3
 /**
7
 /**
4
  * The style of the conference UI (component).
8
  * The style of the conference UI (component).
15
     /**
19
     /**
16
      * Conference style.
20
      * Conference style.
17
      */
21
      */
18
-    conference: {
22
+    conference: fixAndroidViewClipping({
19
         alignSelf: 'stretch',
23
         alignSelf: 'stretch',
20
         backgroundColor: ColorPalette.appBackground,
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
         flex: 1
25
         flex: 1
28
-    },
26
+    }),
29
 
27
 
30
     /**
28
     /**
31
      * ParticipantView style
29
      * ParticipantView style

+ 8
- 9
react/features/welcome/components/styles.js View File

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
  * The default color of text on the WelcomePage.
9
  * The default color of text on the WelcomePage.
35
     /**
40
     /**
36
      * The style of the top-level container of WelcomePage.
41
      * The style of the top-level container of WelcomePage.
37
      */
42
      */
38
-    container: {
43
+    container: fixAndroidViewClipping({
39
         alignSelf: 'stretch',
44
         alignSelf: 'stretch',
40
         backgroundColor: ColorPalette.blue,
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
         flex: 1
46
         flex: 1
48
-    },
47
+    }),
49
 
48
 
50
     /**
49
     /**
51
      * The style of the legal-related content such as (hyper)links to Privacy
50
      * The style of the legal-related content such as (hyper)links to Privacy

Loading…
Cancel
Save