You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ToolbarButton.native.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import React from 'react';
  2. import { TouchableHighlight } from 'react-native';
  3. import { Icon } from '../../base/font-icons';
  4. import AbstractToolbarButton from './AbstractToolbarButton';
  5. /**
  6. * Represents a button in Toolbar on React Native.
  7. *
  8. * @extends AbstractToolbarButton
  9. */
  10. export default class ToolbarButton extends AbstractToolbarButton {
  11. /**
  12. * ToolbarButton component's property types.
  13. *
  14. * @static
  15. */
  16. static propTypes = AbstractToolbarButton.propTypes
  17. /**
  18. * Renders the button of this Toolbar button.
  19. *
  20. * @param {Object} children - The children, if any, to be rendered inside
  21. * the button. Presumably, contains the icon of this Toolbar button.
  22. * @protected
  23. * @returns {ReactElement} The button of this Toolbar button.
  24. */
  25. _renderButton(children) {
  26. const props = {};
  27. 'onClick' in this.props && (props.onPress = this.props.onClick);
  28. 'style' in this.props && (props.style = this.props.style);
  29. 'underlayColor' in this.props
  30. && (props.underlayColor = this.props.underlayColor);
  31. return React.createElement(TouchableHighlight, props, children);
  32. }
  33. // eslint-disable-next-line valid-jsdoc
  34. /**
  35. * @inheritdoc
  36. */
  37. _renderIcon() {
  38. return super._renderIcon(Icon);
  39. }
  40. }