import React from 'react';
import {
Animated,
Keyboard,
SafeAreaView,
Switch,
TextInput,
TouchableHighlight,
TouchableOpacity,
View
} from 'react-native';
import { connect } from 'react-redux';
import { AppSettings } from '../../app-settings';
import { translate } from '../../base/i18n';
import { Icon } from '../../base/font-icons';
import { MEDIA_TYPE } from '../../base/media';
import { updateProfile } from '../../base/profile';
import {
LoadingIndicator,
Header,
Text
} from '../../base/react';
import { ColorPalette, PlatformElements } from '../../base/styles';
import {
createDesiredLocalTracks,
destroyLocalTracks
} from '../../base/tracks';
import { RecentList } from '../../recent-list';
import { setSideBarVisibility } from '../actions';
import { AbstractWelcomePage, _mapStateToProps } from './AbstractWelcomePage';
import LocalVideoTrackUnderlay from './LocalVideoTrackUnderlay';
import styles, {
PLACEHOLDER_TEXT_COLOR,
SWITCH_THUMB_COLOR,
SWITCH_UNDER_COLOR
} from './styles';
import WelcomePageSideBar from './WelcomePageSideBar';
/**
* The native container rendering the welcome page.
*
* @extends AbstractWelcomePage
*/
class WelcomePage extends AbstractWelcomePage {
/**
* WelcomePage component's property types.
*
* @static
*/
static propTypes = AbstractWelcomePage.propTypes;
/**
* Constructor of the Component.
*
* @inheritdoc
*/
constructor(props) {
super(props);
this.state.hintBoxAnimation = new Animated.Value(0);
this._getHintBoxStyle = this._getHintBoxStyle.bind(this);
this._onFieldFocusChange = this._onFieldFocusChange.bind(this);
this._onShowSideBar = this._onShowSideBar.bind(this);
this._onStartAudioOnlyChange = this._onStartAudioOnlyChange.bind(this);
this._renderHintBox = this._renderHintBox.bind(this);
}
/**
* Implements React's {@link Component#componentWillMount()}. Invoked
* immediately before mounting occurs. Creates a local video track if none
* is available.
*
* @inheritdoc
* @returns {void}
*/
componentWillMount() {
super.componentWillMount();
const { dispatch } = this.props;
if (this.props._profile.startAudioOnly) {
dispatch(destroyLocalTracks());
} else {
dispatch(createDesiredLocalTracks(MEDIA_TYPE.VIDEO));
}
}
/**
* Implements React's {@link Component#render()}. Renders a prompt for
* entering a room name.
*
* @inheritdoc
* @returns {ReactElement}
*/
render() {
const { t, _profile } = this.props;
return (
{ t('welcomepage.videoEnabledLabel') }
{ t('welcomepage.audioOnlyLabel') }
{
this._renderHintBox()
}
);
}
/**
* Constructs a style array to handle the hint box animation.
*
* @private
* @returns {Array