浏览代码

fix(desktop_picker): Use defaultProps

j8
hristoterezov 7 年前
父节点
当前提交
cee523fbf1
共有 1 个文件被更改,包括 13 次插入4 次删除
  1. 13
    4
      react/features/desktop-picker/components/DesktopPicker.js

+ 13
- 4
react/features/desktop-picker/components/DesktopPicker.js 查看文件

@@ -39,6 +39,15 @@ const VALID_TYPES = TAB_CONFIGURATIONS.map(c => c.type);
39 39
  * @extends Component
40 40
  */
41 41
 class DesktopPicker extends Component {
42
+    /**
43
+     * Default values for DesktopPicker component's properties.
44
+     *
45
+     * @static
46
+     */
47
+    static defaultProps = {
48
+        options: {}
49
+    };
50
+
42 51
     /**
43 52
      * DesktopPicker component's property types.
44 53
      *
@@ -102,10 +111,10 @@ class DesktopPicker extends Component {
102 111
      * @inheritdoc
103 112
      */
104 113
     componentWillMount() {
105
-        const options = this.props.options || {};
114
+        const { desktopSharingSources } = this.props.options;
106 115
 
107 116
         this._onSourceTypesConfigChanged(
108
-            options.desktopSharingSources);
117
+            desktopSharingSources);
109 118
         this._updateSources();
110 119
         this._startPolling();
111 120
     }
@@ -130,10 +139,10 @@ class DesktopPicker extends Component {
130 139
             });
131 140
         }
132 141
 
133
-        const options = this.props.options || {};
142
+        const { desktopSharingSources } = this.props.options;
134 143
 
135 144
         this._onSourceTypesConfigChanged(
136
-            options.desktopSharingSources);
145
+            desktopSharingSources);
137 146
     }
138 147
 
139 148
     /**

正在加载...
取消
保存