Bläddra i källkod

feat(toolbox): add ability to run a handler after click to AbstractButton

master
Saúl Ibarra Corretgé 7 år sedan
förälder
incheckning
99b5a41269
1 ändrade filer med 9 tillägg och 0 borttagningar
  1. 9
    0
      react/features/base/toolbox/components/AbstractButton.js

+ 9
- 0
react/features/base/toolbox/components/AbstractButton.js Visa fil

@@ -7,6 +7,11 @@ import ToolboxItem from './ToolboxItem';
7 7
 
8 8
 export type Props = {
9 9
 
10
+    /**
11
+     * Function to be called after the click handler has been processed.
12
+     */
13
+    afterClick: ?Function,
14
+
10 15
     /**
11 16
      * Whether to show the label or not.
12 17
      */
@@ -38,6 +43,7 @@ export type Props = {
38 43
  */
39 44
 export default class AbstractButton<P: Props, S: *> extends Component<P, S> {
40 45
     static defaultProps = {
46
+        afterClick: undefined,
41 47
         showLabel: false,
42 48
         styles: undefined,
43 49
         toggledStyles: undefined,
@@ -165,7 +171,10 @@ export default class AbstractButton<P: Props, S: *> extends Component<P, S> {
165 171
      * @returns {void}
166 172
      */
167 173
     _onClick() {
174
+        const { afterClick } = this.props;
175
+
168 176
         this._handleClick();
177
+        afterClick && afterClick();
169 178
     }
170 179
 
171 180
     /**

Laddar…
Avbryt
Spara