2016-10-05 14:36:59 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { TouchableHighlight } from 'react-native';
|
|
|
|
|
2017-01-17 14:44:50 +00:00
|
|
|
import { Icon } from '../../base/font-icons';
|
2016-10-05 14:36:59 +00:00
|
|
|
|
|
|
|
import AbstractToolbarButton from './AbstractToolbarButton';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents a button in Toolbar on React Native.
|
|
|
|
*
|
|
|
|
* @extends AbstractToolbarButton
|
|
|
|
*/
|
|
|
|
export default class ToolbarButton extends AbstractToolbarButton {
|
2016-12-01 01:52:39 +00:00
|
|
|
/**
|
|
|
|
* ToolbarButton component's property types.
|
|
|
|
*
|
|
|
|
* @static
|
|
|
|
*/
|
|
|
|
static propTypes = AbstractToolbarButton.propTypes
|
2016-10-05 14:36:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders the button of this Toolbar button.
|
|
|
|
*
|
|
|
|
* @param {Object} children - The children, if any, to be rendered inside
|
|
|
|
* the button. Presumably, contains the icon of this Toolbar button.
|
|
|
|
* @protected
|
|
|
|
* @returns {ReactElement} The button of this Toolbar button.
|
|
|
|
*/
|
|
|
|
_renderButton(children) {
|
|
|
|
const props = {};
|
|
|
|
|
|
|
|
'onClick' in this.props && (props.onPress = this.props.onClick);
|
|
|
|
'style' in this.props && (props.style = this.props.style);
|
|
|
|
'underlayColor' in this.props
|
|
|
|
&& (props.underlayColor = this.props.underlayColor);
|
|
|
|
|
|
|
|
return React.createElement(TouchableHighlight, props, children);
|
|
|
|
}
|
|
|
|
|
|
|
|
// eslint-disable-next-line valid-jsdoc
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
_renderIcon() {
|
|
|
|
return super._renderIcon(Icon);
|
|
|
|
}
|
|
|
|
}
|