Sfoglia il codice sorgente

ref(Toolbox.native): extract _renderToolbars

master
paweldomas 7 anni fa
parent
commit
3e9d26b525
1 ha cambiato i file con 20 aggiunte e 10 eliminazioni
  1. 20
    10
      react/features/toolbox/components/Toolbox.native.js

+ 20
- 10
react/features/toolbox/components/Toolbox.native.js Vedi File

@@ -127,16 +127,7 @@ class Toolbox extends Component {
127 127
                         ? styles.toolbarContainerNarrow
128 128
                         : styles.toolbarContainerWide }
129 129
                 visible = { this.props._visible } >
130
-                {
131
-                    isNarrowAspectRatio(this)
132
-                        ? this._renderSecondaryToolbar()
133
-                        : this._renderPrimaryToolbar()
134
-                }
135
-                {
136
-                    isNarrowAspectRatio(this)
137
-                        ? this._renderPrimaryToolbar()
138
-                        : this._renderSecondaryToolbar()
139
-                }
130
+                { this._renderToolbars() }
140 131
             </Container>
141 132
         );
142 133
     }
@@ -315,6 +306,25 @@ class Toolbox extends Component {
315 306
 
316 307
         /* eslint-enable react/jsx-curly-spacing,react/jsx-handler-names */
317 308
     }
309
+
310
+    /**
311
+     * Renders the primary and the secondary toolbars in the order depending on
312
+     * the current aspect ratio.
313
+     *
314
+     * @returns {[ReactElement, ReactElement]}
315
+     * @private
316
+     */
317
+    _renderToolbars() {
318
+        if (isNarrowAspectRatio(this)) {
319
+            return [
320
+                this._renderSecondaryToolbar(),
321
+                this._renderPrimaryToolbar()
322
+            ];
323
+        }
324
+
325
+        return [ this._renderPrimaryToolbar(), this._renderSecondaryToolbar() ];
326
+    }
327
+
318 328
 }
319 329
 
320 330
 /**

Loading…
Annulla
Salva