Bläddra i källkod

[RN] Add ability to disable a ToolbarButton

j8
Saúl Ibarra Corretgé 8 år sedan
förälder
incheckning
055df1c12e
1 ändrade filer med 4 tillägg och 7 borttagningar
  1. 4
    7
      react/features/toolbox/components/ToolbarButton.native.js

+ 4
- 7
react/features/toolbox/components/ToolbarButton.native.js Visa fil

21
         ...AbstractToolbarButton.propTypes,
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
     _renderButton(children) {
37
     _renderButton(children) {
38
         const props = {};
38
         const props = {};
39
 
39
 
40
+        'disabled' in this.props && (props.disabled = this.props.disabled);
40
         'onClick' in this.props && (props.onPress = event => {
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
         'style' in this.props && (props.style = this.props.style);
44
         'style' in this.props && (props.style = this.props.style);
48
         'underlayColor' in this.props
45
         'underlayColor' in this.props

Laddar…
Avbryt
Spara