Selaa lähdekoodia

ref(Toolbox.native): extract _renderToolbars

master
paweldomas 7 vuotta sitten
vanhempi
commit
3e9d26b525
1 muutettua tiedostoa jossa 20 lisäystä ja 10 poistoa
  1. 20
    10
      react/features/toolbox/components/Toolbox.native.js

+ 20
- 10
react/features/toolbox/components/Toolbox.native.js Näytä tiedosto

127
                         ? styles.toolbarContainerNarrow
127
                         ? styles.toolbarContainerNarrow
128
                         : styles.toolbarContainerWide }
128
                         : styles.toolbarContainerWide }
129
                 visible = { this.props._visible } >
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
             </Container>
131
             </Container>
141
         );
132
         );
142
     }
133
     }
315
 
306
 
316
         /* eslint-enable react/jsx-curly-spacing,react/jsx-handler-names */
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…
Peruuta
Tallenna