瀏覽代碼

[RN] Add ability to disable a ToolbarButton

j8
Saúl Ibarra Corretgé 8 年之前
父節點
當前提交
055df1c12e
共有 1 個文件被更改,包括 4 次插入7 次删除
  1. 4
    7
      react/features/toolbox/components/ToolbarButton.native.js

+ 4
- 7
react/features/toolbox/components/ToolbarButton.native.js 查看文件

@@ -21,9 +21,9 @@ class ToolbarButton extends AbstractToolbarButton {
21 21
         ...AbstractToolbarButton.propTypes,
22 22
 
23 23
         /**
24
-         * Used to dispatch an action when the button is clicked.
24
+         * Indicates if this button is disabled or not.
25 25
          */
26
-        dispatch: React.PropTypes.func
26
+        disabled: React.PropTypes.bool
27 27
     };
28 28
 
29 29
     /**
@@ -37,12 +37,9 @@ class ToolbarButton extends AbstractToolbarButton {
37 37
     _renderButton(children) {
38 38
         const props = {};
39 39
 
40
+        'disabled' in this.props && (props.disabled = this.props.disabled);
40 41
         'onClick' in this.props && (props.onPress = event => {
41
-            const action = this.props.onClick(event);
42
-
43
-            if (action) {
44
-                this.props.dispatch(action);
45
-            }
42
+            this.props.onClick(event);
46 43
         });
47 44
         'style' in this.props && (props.style = this.props.style);
48 45
         'underlayColor' in this.props

Loading…
取消
儲存