@ -4,7 +4,7 @@ import { connect } from 'react-redux';
import { translate } from '../../base/i18n' ;
import { MEDIA _TYPE } from '../../base/media' ;
import { Link , Text } from '../../base/react' ;
import { Link , LoadingIndicator , Text } from '../../base/react' ;
import { ColorPalette } from '../../base/styles' ;
import { createDesiredLocalTracks } from '../../base/tracks' ;
@ -41,18 +41,24 @@ class WelcomePage extends AbstractWelcomePage {
static propTypes = AbstractWelcomePage . propTypes ;
/ * *
* Creates a video track if not already available .
* 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 ( ) ;
this . props . dispatch ( createDesiredLocalTracks ( MEDIA _TYPE . VIDEO ) ) ;
}
/ * *
* Renders a prompt for entering a room name .
* Implements React ' s { @ link Component # render ( ) } . Renders a prompt for
* entering a room name .
*
* @ inheritdoc
* @ returns { ReactElement }
* /
render ( ) {
@ -75,16 +81,9 @@ class WelcomePage extends AbstractWelcomePage {
style = { styles . textInput }
underlineColorAndroid = 'transparent'
value = { this . state . room } / >
< TouchableHighlight
accessibilityLabel = { 'Tap to Join.' }
disabled = { this . _isJoinDisabled ( ) }
onPress = { this . _onJoin }
style = { styles . button }
underlayColor = { ColorPalette . white } >
< Text style = { styles . buttonText } >
{ t ( 'welcomepage.join' ) }
< / T e x t >
< / T o u c h a b l e H i g h l i g h t >
{
this . _renderJoinButton ( )
}
< / V i e w >
{
this . _renderLegalese ( )
@ -93,6 +92,50 @@ class WelcomePage extends AbstractWelcomePage {
) ;
}
/ * *
* Renders the join button .
*
* @ private
* @ returns { ReactElement }
* /
_renderJoinButton ( ) {
let children ;
/* eslint-disable no-extra-parens */
if ( this . state . joining ) {
// TouchableHighlight is picky about what its children can be, so
// wrap it in a native component, i.e. View to avoid having to
// modify non-native children.
children = (
< View >
< LoadingIndicator / >
< / V i e w >
) ;
} else {
children = (
< Text style = { styles . buttonText } >
{ this . props . t ( 'welcomepage.join' ) }
< / T e x t >
) ;
}
/* eslint-enable no-extra-parens */
return (
< TouchableHighlight
accessibilityLabel = { 'Tap to Join.' }
disabled = { this . _isJoinDisabled ( ) }
onPress = { this . _onJoin }
style = { styles . button }
underlayColor = { ColorPalette . white } >
{
children
}
< / T o u c h a b l e H i g h l i g h t >
) ;
}
/ * *
* Renders legal - related content such as Terms of service / use , Privacy
* policy , etc .