Przeglądaj źródła

[RN] Add ability to disable a ToolbarButton

master
Saúl Ibarra Corretgé 8 lat temu
rodzic
commit
055df1c12e

+ 4
- 7
react/features/toolbox/components/ToolbarButton.native.js Wyświetl plik

@@ -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

Ładowanie…
Anuluj
Zapisz