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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import React from 'react';
  2. import { TouchableHighlight } from 'react-native';
  3. import { Icon } from '../../base/fontIcons';
  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. * Renders the button of this Toolbar button.
  13. *
  14. * @param {Object} children - The children, if any, to be rendered inside
  15. * the button. Presumably, contains the icon of this Toolbar button.
  16. * @protected
  17. * @returns {ReactElement} The button of this Toolbar button.
  18. */
  19. _renderButton(children) {
  20. const props = {};
  21. 'onClick' in this.props && (props.onPress = this.props.onClick);
  22. 'style' in this.props && (props.style = this.props.style);
  23. 'underlayColor' in this.props
  24. && (props.underlayColor = this.props.underlayColor);
  25. return React.createElement(TouchableHighlight, props, children);
  26. }
  27. // eslint-disable-next-line valid-jsdoc
  28. /**
  29. * @inheritdoc
  30. */
  31. _renderIcon() {
  32. return super._renderIcon(Icon);
  33. }
  34. }
  35. /**
  36. * ToolbarButton component's property types.
  37. *
  38. * @static
  39. */
  40. ToolbarButton.propTypes = AbstractToolbarButton.propTypes;