// @flow import React from 'react'; import { Text, View, TouchableOpacity, TextInput } from 'react-native'; import { Avatar } from '../../../base/avatar'; import { CustomDialog } from '../../../base/dialog'; import { translate } from '../../../base/i18n'; import { Icon, IconEdit } from '../../../base/icons'; import { LoadingIndicator } from '../../../base/react'; import { connect } from '../../../base/redux'; import AbstractLobbyScreen, { _mapStateToProps } from '../AbstractLobbyScreen'; import styles from './styles'; /** * Implements a waiting screen that represents the participant being in the lobby. */ class LobbyScreen extends AbstractLobbyScreen { /** * Implements {@code PureComponent#render}. * * @inheritdoc */ render() { const { _meetingName, t } = this.props; return ( { t(this._getScreenTitleKey()) } { _meetingName } { this._renderContent() } ); } _getScreenTitleKey: () => string; _onAskToJoin: () => void; _onCancel: () => boolean; _onChangeDisplayName: Object => void; _onChangeEmail: Object => void; _onChangePassword: Object => void; _onEnableEdit: () => void; _onJoinWithPassword: () => void; _onSwitchToKnockMode: () => void; _onSwitchToPasswordMode: () => void; _renderContent: () => React$Element<*>; /** * Renders the joining (waiting) fragment of the screen. * * @inheritdoc */ _renderJoining() { return ( <> { this.props.t('lobby.joiningMessage') } { this._renderStandardButtons() } ); } /** * Renders the participant form to let the knocking participant enter its details. * * @inheritdoc */ _renderParticipantForm() { const { t } = this.props; const { displayName, email } = this.state; return ( { t('lobby.nameField') } { t('lobby.emailField') } ); } /** * Renders the participant info fragment when we have all the required details of the user. * * @inheritdoc */ _renderParticipantInfo() { const { displayName, email } = this.state; return ( { displayName } { Boolean(email) && { email } } ); } /** * Renders the password form to let the participant join by using a password instead of knocking. * * @inheritdoc */ _renderPasswordForm() { const { _passwordJoinFailed, t } = this.props; return ( { this.props.t('lobby.passwordField') } { _passwordJoinFailed && { t('lobby.invalidPassword') } } ); } /** * Renders the password join button (set). * * @inheritdoc */ _renderPasswordJoinButtons() { const { t } = this.props; return ( <> { t('lobby.passwordJoinButton') } { t('lobby.backToKnockModeButton') } ); } /** * Renders the standard button set. * * @inheritdoc */ _renderStandardButtons() { const { _knocking, _renderPassword, t } = this.props; return ( <> { _knocking || { t('lobby.knockButton') } } { _renderPassword && { t('lobby.enterPasswordButton') } } ); } } export default translate(connect(_mapStateToProps)(LobbyScreen));