// @flow import React, { Component } from 'react'; import { Image, Text, View } from 'react-native'; import LinearGradient from 'react-native-linear-gradient'; import { Avatar } from '../../../base/avatar'; import { translate } from '../../../base/i18n'; import { connect } from '../../../base/redux'; import AnswerButton from './AnswerButton'; import DeclineButton from './DeclineButton'; import styles, { AVATAR_BORDER_GRADIENT, BACKGROUND_OVERLAY_GRADIENT, CALLER_AVATAR_SIZE } from './styles'; /** * The type of React {@code Component} props of {@link IncomingCallPage}. */ type Props = { /** * Caller's avatar URL. */ _callerAvatarURL: string, /** * Caller's name. */ _callerName: string, /** * Whether the call has video or not. */ _hasVideo: boolean, /** * Helper for translating strings. */ t: Function }; /** * The React {@code Component} displays an incoming call screen. */ class IncomingCallPage extends Component { /** * Implements React's {@link Component#render()}. * * @inheritdoc * @returns {ReactElement} */ render() { const { t, _callerName, _hasVideo } = this.props; const callTitle = _hasVideo ? t('incomingCall.videoCallTitle') : t('incomingCall.audioCallTitle'); return ( { callTitle } { _callerName } { t('incomingCall.productLabel') } { this._renderCallerAvatar() } { this._renderButtons() } ); } /** * Renders buttons. * * @private * @returns {React$Node} */ _renderButtons() { const { t } = this.props; return ( { t('incomingCall.decline') } { t('incomingCall.answer') } ); } /** * Renders caller avatar. * * @private * @returns {React$Node} */ _renderCallerAvatar() { return ( ); } } /** * Maps (parts of) the redux state to the component's props. * * @param {Object} state - The redux state. * @param {Object} ownProps - The component's own props. * @private * @returns {{ * _callerAvatarURL: string, * _callerName: string, * _hasVideo: boolean * }} */ function _mapStateToProps(state) { const { caller } = state['features/mobile/incoming-call'] || {}; return { /** * The caller's avatar url. * * @private * @type {string} */ _callerAvatarURL: caller.avatarUrl, /** * The caller's name. * * @private * @type {string} */ _callerName: caller.name, /** * Whether the call has video or not. * * @private * @type {boolean} */ _hasVideo: caller.hasVideo }; } export default translate(connect(_mapStateToProps)(IncomingCallPage));