您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

MessageRecipient.js 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // @flow
  2. import React from 'react';
  3. import { Text, TouchableHighlight, View } from 'react-native';
  4. import { ColorSchemeRegistry } from '../../../base/color-scheme';
  5. import { translate } from '../../../base/i18n';
  6. import { Icon, IconCancelSelection } from '../../../base/icons';
  7. import { connect } from '../../../base/redux';
  8. import { type StyleType } from '../../../base/styles';
  9. import AbstractMessageRecipient, {
  10. _mapDispatchToProps,
  11. _mapStateToProps as _abstractMapStateToProps,
  12. type Props as AbstractProps
  13. } from '../AbstractMessageRecipient';
  14. type Props = AbstractProps & {
  15. /**
  16. * The color-schemed stylesheet of the feature.
  17. */
  18. _styles: StyleType
  19. };
  20. /**
  21. * Class to implement the displaying of the recipient of the next message.
  22. */
  23. class MessageRecipient extends AbstractMessageRecipient<Props> {
  24. /**
  25. * Implements {@code PureComponent#render}.
  26. *
  27. * @inheritdoc
  28. */
  29. render() {
  30. const { _privateMessageRecipient, _styles } = this.props;
  31. if (!_privateMessageRecipient) {
  32. return null;
  33. }
  34. const { t } = this.props;
  35. return (
  36. <View style = { _styles.messageRecipientContainer }>
  37. <Text style = { _styles.messageRecipientText }>
  38. { t('chat.messageTo', {
  39. recipient: _privateMessageRecipient
  40. }) }
  41. </Text>
  42. <TouchableHighlight onPress = { this.props._onRemovePrivateMessageRecipient }>
  43. <Icon
  44. src = { IconCancelSelection }
  45. style = { _styles.messageRecipientCancelIcon } />
  46. </TouchableHighlight>
  47. </View>
  48. );
  49. }
  50. }
  51. /**
  52. * Maps part of the redux state to the props of this component.
  53. *
  54. * @param {Object} state - The Redux state.
  55. * @returns {Props}
  56. */
  57. function _mapStateToProps(state) {
  58. return {
  59. ..._abstractMapStateToProps(state),
  60. _styles: ColorSchemeRegistry.get(state, 'Chat')
  61. };
  62. }
  63. export default translate(connect(_mapStateToProps, _mapDispatchToProps)(MessageRecipient));