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.

Chat.js 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // @flow
  2. import React from 'react';
  3. import { KeyboardAvoidingView, SafeAreaView } from 'react-native';
  4. import { translate } from '../../../base/i18n';
  5. import {
  6. BackButton,
  7. Header,
  8. HeaderLabel,
  9. SlidingView
  10. } from '../../../base/react';
  11. import { connect } from '../../../base/redux';
  12. import AbstractChat, {
  13. _mapDispatchToProps,
  14. _mapStateToProps,
  15. type Props
  16. } from '../AbstractChat';
  17. import ChatInputBar from './ChatInputBar';
  18. import MessageContainer from './MessageContainer';
  19. import styles from './styles';
  20. /**
  21. * Implements a React native component that renders the chat window (modal) of
  22. * the mobile client.
  23. */
  24. class Chat extends AbstractChat<Props> {
  25. /**
  26. * Implements React's {@link Component#render()}.
  27. *
  28. * @inheritdoc
  29. */
  30. render() {
  31. return (
  32. <SlidingView
  33. position = 'bottom'
  34. show = { this.props._isOpen } >
  35. <KeyboardAvoidingView
  36. behavior = 'padding'
  37. style = { styles.chatContainer }>
  38. <Header>
  39. <BackButton onPress = { this.props._onToggleChat } />
  40. <HeaderLabel labelKey = 'chat.title' />
  41. </Header>
  42. <SafeAreaView style = { styles.backdrop }>
  43. <MessageContainer messages = { this.props._messages } />
  44. <ChatInputBar onSend = { this.props._onSendMessage } />
  45. </SafeAreaView>
  46. </KeyboardAvoidingView>
  47. </SlidingView>
  48. );
  49. }
  50. }
  51. export default translate(connect(_mapStateToProps, _mapDispatchToProps)(Chat));