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

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