ref(Toolbox.native): extract _renderToolbars

This commit is contained in:
paweldomas 2017-10-19 13:29:34 -05:00 committed by Lyubo Marinov
parent 320cfe4745
commit 3e9d26b525
1 changed files with 20 additions and 10 deletions

View File

@ -127,16 +127,7 @@ class Toolbox extends Component {
? styles.toolbarContainerNarrow
: styles.toolbarContainerWide }
visible = { this.props._visible } >
{
isNarrowAspectRatio(this)
? this._renderSecondaryToolbar()
: this._renderPrimaryToolbar()
}
{
isNarrowAspectRatio(this)
? this._renderPrimaryToolbar()
: this._renderSecondaryToolbar()
}
{ this._renderToolbars() }
</Container>
);
}
@ -315,6 +306,25 @@ class Toolbox extends Component {
/* eslint-enable react/jsx-curly-spacing,react/jsx-handler-names */
}
/**
* Renders the primary and the secondary toolbars in the order depending on
* the current aspect ratio.
*
* @returns {[ReactElement, ReactElement]}
* @private
*/
_renderToolbars() {
if (isNarrowAspectRatio(this)) {
return [
this._renderSecondaryToolbar(),
this._renderPrimaryToolbar()
];
}
return [ this._renderPrimaryToolbar(), this._renderSecondaryToolbar() ];
}
}
/**